diff --git a/libvips/foreign/magick7load.c b/libvips/foreign/magick7load.c index def1b2cb..6a499410 100644 --- a/libvips/foreign/magick7load.c +++ b/libvips/foreign/magick7load.c @@ -50,7 +50,7 @@ #ifdef HAVE_MAGICK7 -#include +#include typedef struct _VipsForeignLoadMagick7 { VipsForeignLoad parent_object; @@ -336,6 +336,8 @@ vips_foreign_load_magick7_parse( VipsForeignLoadMagick7 *magick7, break; default: + /* Things like GIF have no resolution info. + */ out->Xres = 1.0; out->Yres = 1.0; break; diff --git a/test/test_foreign.py b/test/test_foreign.py index a4e904df..43e4ebd5 100755 --- a/test/test_foreign.py +++ b/test/test_foreign.py @@ -314,17 +314,12 @@ class TestForeign(unittest.TestCase): return def gif_valid(self, im): - a = im(10, 10) # some libMagick produce an RGB for this image, some a mono, some - # rgba :-( - if len(a) == 4: - self.assertAlmostEqual(a, [33, 33, 33, 255]) - elif len(a) == 3: - self.assertAlmostEqual(a, [33, 33, 33]) - else: - self.assertAlmostEqual(a, [33]) + # rgba, some have a valid alpha, some don't :-( + # therefore ... just test channel 0 + a = im(10, 10)[0] - self.assertEqual(im.bands, len(a)) + self.assertAlmostEqual(a, 33) self.assertEqual(im.width, 159) self.assertEqual(im.height, 203)