fix load from buffer, update APIs
This commit is contained in:
parent
0dbd64a122
commit
c2be771342
7
TODO
7
TODO
@ -1,10 +1,3 @@
|
||||
- gif loader
|
||||
|
||||
need tests, need to update APIs
|
||||
|
||||
|
||||
|
||||
|
||||
- could load pdf thumbnails?
|
||||
|
||||
- new vips_reduce:
|
||||
|
@ -1,5 +1,5 @@
|
||||
// headers for vips operations
|
||||
// Tue Feb 9 10:43:17 GMT 2016
|
||||
// Fri Feb 12 20:04:03 GMT 2016
|
||||
// this file is generated automatically, do not edit!
|
||||
|
||||
static void system( char * cmd_format , VOption *options = 0 );
|
||||
@ -114,6 +114,8 @@ static VImage pdfload( char * filename , VOption *options = 0 );
|
||||
static VImage pdfload_buffer( VipsBlob * buffer , VOption *options = 0 );
|
||||
static VImage svgload( char * filename , VOption *options = 0 );
|
||||
static VImage svgload_buffer( VipsBlob * buffer , VOption *options = 0 );
|
||||
static VImage gifload( char * filename , VOption *options = 0 );
|
||||
static VImage gifload_buffer( VipsBlob * buffer , VOption *options = 0 );
|
||||
static VImage pngload( char * filename , VOption *options = 0 );
|
||||
static VImage pngload_buffer( VipsBlob * buffer , VOption *options = 0 );
|
||||
static VImage matload( char * filename , VOption *options = 0 );
|
||||
|
@ -1,5 +1,5 @@
|
||||
// bodies for vips operations
|
||||
// Tue Feb 9 10:43:09 GMT 2016
|
||||
// Fri Feb 12 20:03:53 GMT 2016
|
||||
// this file is generated automatically, do not edit!
|
||||
|
||||
void VImage::system( char * cmd_format , VOption *options )
|
||||
@ -1456,6 +1456,30 @@ VImage VImage::svgload_buffer( VipsBlob * buffer , VOption *options )
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::gifload( char * filename , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
||||
call( "gifload" ,
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "filename", filename ) ->
|
||||
set( "out", &out ) );
|
||||
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::gifload_buffer( VipsBlob * buffer , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
||||
call( "gifload_buffer" ,
|
||||
(options ? options : VImage::option()) ->
|
||||
set( "buffer", buffer ) ->
|
||||
set( "out", &out ) );
|
||||
|
||||
return( out );
|
||||
}
|
||||
|
||||
VImage VImage::pngload( char * filename , VOption *options )
|
||||
{
|
||||
VImage out;
|
||||
|
@ -508,6 +508,7 @@ vips_foreign_load_gif_buffer_read( GifFileType *file,
|
||||
size_t will_read = VIPS_MIN( len, buffer->bytes_to_go );
|
||||
|
||||
memcpy( buf, buffer->p, will_read );
|
||||
buffer->p += will_read;
|
||||
buffer->bytes_to_go -= will_read;
|
||||
|
||||
return( will_read );
|
||||
|
@ -1097,6 +1097,8 @@ class_methods = [
|
||||
"pdfload_buffer",
|
||||
"svgload",
|
||||
"svgload_buffer",
|
||||
"gifload",
|
||||
"gifload_buffer",
|
||||
"openslideload",
|
||||
"magickload",
|
||||
"magickload_buffer",
|
||||
|
BIN
test/images/trans-x.gif
Normal file
BIN
test/images/trans-x.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -365,6 +365,22 @@ class TestForeign(unittest.TestCase):
|
||||
self.assertLess(abs(im.width * 2 - x.width), 2)
|
||||
self.assertLess(abs(im.height * 2 - x.height), 2)
|
||||
|
||||
def test_gifload(self):
|
||||
x = Vips.type_find("VipsForeign", "gifload")
|
||||
if not x.is_instantiatable():
|
||||
print("no gif support in this vips, skipping test")
|
||||
return
|
||||
|
||||
def gif_valid(self, im):
|
||||
a = im(10, 10)
|
||||
self.assertAlmostEqualObjects(a, [33, 33, 33, 255])
|
||||
self.assertEqual(im.width, 159)
|
||||
self.assertEqual(im.height, 203)
|
||||
self.assertEqual(im.bands, 4)
|
||||
|
||||
self.file_loader("gifload", self.gif_file, gif_valid)
|
||||
self.buffer_loader("gifload_buffer", self.gif_file, gif_valid)
|
||||
|
||||
def test_svgload(self):
|
||||
x = Vips.type_find("VipsForeign", "svgload")
|
||||
if not x.is_instantiatable():
|
||||
|
Loading…
Reference in New Issue
Block a user