Skip to content
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

Fix loading buggy images #1187

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

wolfrosnet
Copy link

Fix an error when loading an image that had the original extension "PNG" but was saved as "JPG".
I have attached a sample image.
road pothole144

Copy link
Contributor

@pelennor pelennor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about not to decide buggy images by comparing extensions and Image.mode, but using file MIME type.

For example, using get_format_mimetype method(https://pillow.readthedocs.io/en/stable/releasenotes/5.2.0.html#imagefile-get-format-mimetype)

In my opinion, using MIME type gives you much more reliable informations.

@wolfrosnet
Copy link
Author

wolfrosnet commented Jan 9, 2023 via email

@wkentaro wkentaro force-pushed the main branch 2 times, most recently from 308473f to bb15893 Compare April 13, 2023 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants