-
-
Notifications
You must be signed in to change notification settings - Fork 32k
bpo-44539: Support recognizing JPEG files without JFIF or Exif markers #26964
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
Conversation
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA). CLA MissingOur records indicate the following people have not signed the CLA: For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. If you have recently signed the CLA, please wait at least one business day You can check yourself to see if the CLA has been received. Thanks again for the contribution, we look forward to reviewing it! |
`imghdr.what` method fail in checking some JPG images. `imghdr.what` use the following command to check for JPG by checking the header: `[6:10] in (b'JFIF', b'Exif')` However, its not always the case as some might - quantized JPG - can start with b'\xff\xd8\xff\xdb' headers and not including `(b'JFIF', b'Exif')` as described in the references [here](https://www.digicamsoft.com/itu/itu-t81-36.html) and [here](https://web.archive.org/web/20120403212223/http://class.ee.iastate.edu/ee528/Reading%20material/JPEG_File_Format.pdf). PIL can be an alternative for that issue until imghdr bug is fixed [issue](python/cpython#26964 (comment))
`imghdr.what` method fail in checking some JPG images. `imghdr.what` uses the following command to check for JPG by checking the header: `[6:10] in (b'JFIF', b'Exif')` However, its not always the case as some might - quantized JPG - can start with b'\xff\xd8\xff\xdb' headers and not including `(b'JFIF', b'Exif')` as described in the references [here](https://www.digicamsoft.com/itu/itu-t81-36.html) and [here](https://web.archive.org/web/20120403212223/http://class.ee.iastate.edu/ee528/Reading%20material/JPEG_File_Format.pdf). PIL can be an alternative for that issue until imghdr bug is fixed [issue](python/cpython#26964 (comment))
Thanks for the PR, @mohamadmansourX. I was able to test this PR on a
It would be nice to have a test case for this over Also, please see the message about the CLA. There's also something wrong with the news entry but I couldn't figure that out |
# Don't start with "- Issue #<n>: " or "- bpo-<n>: " or that sort of stuff. | ||
########################################################################### | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you remove all the commented lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@merwok do you have any clues regarding the doc error? I tried removing the commented-out lines and running the sphinx toolchain locally but it all broke in the same way :/
Co-authored-by: Éric Araujo <[email protected]>
It seems that some issue with the blurb filename hits a bug in blurb: https://app.travis-ci.com/github/python/cpython/jobs/523615771
|
It’s known and fixed: python/core-workflow#386 Maybe blurb-it needs an update. |
Previous method to check JPG images was using the following command
h[6:10] in (b'JFIF', b'Exif')
However, its not always the case as some might start with
b'\xff\xd8\xff\xdb'
header.\xdb
defining the Quantization Table.Reference:
https://www.digicamsoft.com/itu/itu-t81-36.html
https://web.archive.org/web/20120403212223/http://class.ee.iastate.edu/ee528/Reading%20material/JPEG_File_Format.pdf
As an example, the attached image returned None from the
imghdr.what(filename)
https://bugs.python.org/issue44539