-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_file_blp.py fails with libjpeg 9e since 9.3.0 #6741
Comments
Hi. Just to help us reproduce this, what version of libjpeg are you using? |
I will try running it with a different libjpeg and see if that helps things. |
No need to do that. JPEG images are allowed to be loaded slightly differently. So presuming that the difference is not too great, the test just needs to be relaxed to allow for variation. If you change test_file_blp.py, replacing assert_image_equal_tofile(im, "Tests/images/blp/blp1_jpeg.png") with with Image.open("Tests/images/blp/blp1_jpeg.png") as expected:
assert_image_similar(im, expected., 0.001) the error should change to report an average pixel difference. What is that number? |
I am getting the following: E AssertionError: average pixel value difference 537.3142 > epsilon 0.0010
E assert 0.001 >= 537.3141937255859 Doesn't seem like a small difference :(. |
I just tested it on older machine where we still have libjpeg v6b2 and I see no issue there. |
The reason that this wasn't detected sooner is that Pillow tests with libjpeg-turbo. |
Thanks for the investigation! I renamed the issue to reflect that it's not Solaris but the latest libjpeg that causes this. Interesting that when I revert f7363c1, it works with 9e as well. But I guess that that might be just a coincidence. So, should this issue be reported to libjpeg maintainers instead? |
Do you know where to do that? https://sourceforge.net/p/libjpeg/bugs/ hardly seems active. |
I've created a reproduction not using Pillow, but jpeglib - https://github.com/radarhere/Pillow/tree/6741. This is a library that allow easy switching between libjpeg versions. import jpeglib
jpeglib.version.set('9d')
im = jpeglib.read_spatial("extracted.jpg")
print("9d", im.spatial[0, 0])
jpeglib.version.set('9e')
im = jpeglib.read_spatial("extracted.jpg")
print("9e", im.spatial[0, 0]) gives
|
I've submitted an enquiry using the contact form at https://jpegclub.org/reference/contact/ |
Thanks - I also don't know what the correct way to report issues is - https://sourceforge.net/p/libjpeg/bugs/ seems to have one bug filed not that long ago (and with a reaction), but the contact form might also be a good idea. |
I received a reply. In essence, they have decided to no longer support this particular type of JPEG. I've created PR #6767 to workaround this, by saying that if we determine that a JPEG is CMYK when reading BLP, then it is CMYK.
Thank you for feedback.
There has been old criticism of the JPEG format that it would not specify the colorspace properly.
After this fix I also received false color reports. The new libjpeg version 9e simply applies the same fix to the 4-component colorspaces (YCCK/CMYK). Pink Carpet Magazine's https://pinkcarpetmagazine.wordpress.com/2010/05/15/63-festival-de-cannes/_cmo2106-jpg_cmyk/ 63 Festival de Cannes 12-23 Mai 2010 These images display the same colors with any libjpeg version, and such kind of images are generated by any libjpeg version when selecting CMYK JPEG output. Regards |
What did you do?
I built Pillow 9.3.0 as downloaded from PyPI and ran the test suite with the following command:
/usr/bin/python3.X -m pytest Tests/test_file_blp.py
What did you expect to happen?
Every test passes.
What actually happened?
test_load_blp1
failed with the following error:I don't see this failure in 9.2.0 - it seems that f7363c1 caused this issue. When I revert it, the issue is gone (when I revert only the BlpImagePlugin.py change, pillow segfaults on newly added test_file_blp.py code, but it passes the
assert_image_equal_tofile
part this failure is about.This happens on both SPARC and Intel meaning than endianness is most likely not the issue.
What are your OS, Python and Pillow versions?
The text was updated successfully, but these errors were encountered: