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
Error opening jpeg file #7879
Comments
For from PIL import Image, ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
if __name__ == "__main__":
i = Image.open("bad.jpeg")
i.show() Also, as far as Pillow is concerned at least, this isn't a JPEG image, it's an MPO. |
I doubt the file is corrupted or truncated.. |
Looking at the EXIF matter, I take page 10 of the MPO specification to make that APP1 markers should contain EXIF data in MPO images. However, your MPO image does not. I've created #7884 to update Pillow to be flexible, allowing your code to output this instead -
|
Thank you, it was mainly the Exif reading code that worried me. Issue can be closed) |
Actually, I've updated the PR to fix the reading of the size from your image as well, so the truncation problem is also fixed. |
Wow, this is amazing news, it's nice to know that even photos that do not fully comply with the JPEG format will no longer cause exceptions :) Thank you again, good job. |
Maybe it is something wrong on my setup, but never seen that Pillow had problems with
jpeg
files.Unfortunately currently has no free time to dive and debug/fix it myself.
I will just create an issue, feel free to close it, if after test there will be no problem found.
What are your OS, Python and Pillow versions?
macOS 14
3.11.6
10.2
/10.3.0.dev0
Problematic file(removed)
The text was updated successfully, but these errors were encountered: