argh all_frames doesn't work for gif
This commit is contained in:
parent
40f01fdb2b
commit
8c05a2bbe8
8
TODO
8
TODO
@ -1,8 +1,14 @@
|
||||
- can't read all frames of a gif, we get n_frames = 1
|
||||
|
||||
if all_frames is set, we need to set image_info->number_scenes to something
|
||||
big
|
||||
|
||||
would -1 work for all frames?
|
||||
|
||||
- add tests:
|
||||
|
||||
load 1 page of a pdf/gif
|
||||
load all frames from a pdf/gif
|
||||
load all frames from a pdf/gif/dicom/tiff
|
||||
svg alpha
|
||||
density
|
||||
png alpha
|
||||
|
@ -32,8 +32,8 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
#define DEBUG
|
||||
*/
|
||||
#define DEBUG
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
@ -409,7 +409,6 @@ vips_foreign_load_magick7_parse( VipsForeignLoadMagick7 *magick7,
|
||||
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( magick7 );
|
||||
|
||||
const char *key;
|
||||
Image *p;
|
||||
int i;
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -540,19 +539,7 @@ vips_foreign_load_magick7_parse( VipsForeignLoadMagick7 *magick7,
|
||||
which says this is a volumetric image
|
||||
|
||||
*/
|
||||
magick7->n_frames = 0;
|
||||
for( p = image; p; (p = GetNextImageInList( p )) ) {
|
||||
if( p->columns != (unsigned int) out->Xsize ||
|
||||
p->rows != (unsigned int) out->Ysize ||
|
||||
GetPixelChannels( p ) != out->Bands )
|
||||
break;
|
||||
|
||||
magick7->n_frames += 1;
|
||||
}
|
||||
if( p )
|
||||
/* Nope ... just do the first image in the list.
|
||||
*/
|
||||
magick7->n_frames = 1;
|
||||
magick7->n_frames = GetImageListLength( GetFirstImageInList( image ) );
|
||||
|
||||
#ifdef DEBUG
|
||||
printf( "image has %d frames\n", magick7->n_frames );
|
||||
|
BIN
test/images/cogs.gif
Normal file
BIN
test/images/cogs.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
@ -52,6 +52,7 @@ class TestForeign(unittest.TestCase):
|
||||
self.svg_file = "images/vips-profile.svg"
|
||||
self.svgz_file = "images/vips-profile.svgz"
|
||||
self.svg_gz_file = "images/vips-profile.svg.gz"
|
||||
self.gif_anim_file = "images/cogs.gif"
|
||||
|
||||
self.colour = Vips.Image.jpegload(self.jpeg_file)
|
||||
self.mono = self.colour.extract_band(1)
|
||||
@ -326,6 +327,21 @@ class TestForeign(unittest.TestCase):
|
||||
self.file_loader("magickload", self.gif_file, gif_valid)
|
||||
self.buffer_loader("magickload_buffer", self.gif_file, gif_valid)
|
||||
|
||||
# we should have rgba for svg files
|
||||
im = Vips.Image.magickload(self.svg_file)
|
||||
self.assertEqual(im.bands(), 4)
|
||||
|
||||
# all-frames should load every frame of the animation
|
||||
im = Vips.Image.magickload(self.gif_anim_file)
|
||||
self.assertEqual(im.width(), 85)
|
||||
self.assertEqual(im.height(), 77)
|
||||
self.assertEqual(im.bands(), 4)
|
||||
im = Vips.Image.magickload(self.gif_anim_file, all_frames = True)
|
||||
self.assertEqual(im.width(), 85)
|
||||
self.assertEqual(im.height(), 77 * 100)
|
||||
self.assertEqual(im.bands(), 4)
|
||||
|
||||
|
||||
def test_webp(self):
|
||||
x = Vips.type_find("VipsForeign", "webpload")
|
||||
if not x.is_instantiatable():
|
||||
|
Loading…
Reference in New Issue
Block a user