wagtail / Willow

A wrapper that combines the functionality of multiple Python image libraries into one API
https://willow.wagtail.org/
BSD 3-Clause "New" or "Revised" License
273 stars 53 forks source link

Failing tests with imagemagick 7.1.1-37 #150

Closed mweinelt closed 1 week ago

mweinelt commented 2 weeks ago

After upgrading imagemagick from imagemagick 7.1.1-36 to 7.1.1-37 we saw fthe following tests fail in the willow 1,8.0 test suite.

willow> ____________ TestWandOperations.test_save_as_jpeg_with_icc_profile _____________
willow> 
willow> self = <tests.test_wand.TestWandOperations testMethod=test_save_as_jpeg_with_icc_profile>
willow> 
willow>     def test_save_as_jpeg_with_icc_profile(self):
willow>         images = ["colorchecker_sRGB.jpg", "colorchecker_ECI_RGB_v2.jpg"]
willow>         for img_name in images:
willow>             with open(f"tests/images/{img_name}", "rb") as f:
willow>                 image = WandImage.open(JPEGImageFile(f))
willow>     
willow>             icc_profile = image.get_icc_profile()
willow> >           self.assertIsNotNone(icc_profile)
willow> E           AssertionError: unexpectedly None
willow> 
willow> tests/test_wand.py:169: AssertionError
willow> ____________ TestWandOperations.test_save_as_webp_with_icc_profile _____________
willow> 
willow> self = <tests.test_wand.TestWandOperations testMethod=test_save_as_webp_with_icc_profile>
willow> 
willow>     @unittest.skipIf(no_webp_support, "ImageMagick was built without WebP support")
willow>     def test_save_as_webp_with_icc_profile(self):
willow>         images = ["colorchecker_sRGB.jpg", "colorchecker_ECI_RGB_v2.jpg"]
willow>         for img_name in images:
willow>             with open(f"tests/images/{img_name}", "rb") as f:
willow>                 image = WandImage.open(JPEGImageFile(f))
willow>     
willow>             icc_profile = image.get_icc_profile()
willow> >           self.assertIsNotNone(icc_profile)
willow> E           AssertionError: unexpectedly None
willow> 
willow> tests/test_wand.py:416: AssertionError
Stormheg commented 2 weeks ago

I can confirm I see the same issues with 7.1.1-37 (homebrew version for macOS)

7.1.1-36 does not raise these test errors.


I'll see if I can pinpoint what causes this... investigating.

Stormheg commented 2 weeks ago

Possibly https://github.com/ImageMagick/ImageMagick/commit/f0357c700654bff9fc96b066f5e592a2ce6658e7 could be suspect? It touches a lot of C code related to profiles and image metadata.

From our perspective, it appears ImageMagick 7.1.1-37 doesn't return ICC profiles anymore. That sounds like a bug upstream.

Stormheg commented 1 week ago

ImageMagick 7.1.1-38 is now out and it has fixed the issue for me. Can you confirm @mweinelt?

mweinelt commented 1 week ago

Yes, looks good over here as well!