-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
JPEGs from my Panasonic camera are erroneously recognised as MPOs #1198
Comments
This came up recently. Can you check this? #1138 (comment) |
You are correct, #1138 is the same issue. To clarify, it is definitely something to do with the way certain cameras write their JPEGs: if I load the image in to an editor & save it it is recognized as a JPEG as expected. The workaround for me is to allow MPO as a synonym for JPEG. But other sites may have also been broken by this and not noticed yet! There is a general issue (which is outside the scope of this issue) that recognizing formats by simple names does not work in a world where people come up with formats that are intended to be mistaken for other formats most of the time. The ultimate fix would need to be the equivalent of a class hierarchy, where I could ask 'Is this JPEG?' and get a yes if it is JPEG or any of the ‘subformats’ of JPEG. Either that or have the format reported as JPEG, and have a ‘features’ or ‘flavour’ list that includes the MPO token? But that would annoy people who are expecting format MPO. |
At least in #1138 (comment) the Pillow finds a NumberOfImages tag (tag ID = 45057 = 0xB001, see page 11 of the MPO spec) with a value of 2. My guess is the second frame is a thumbnail. If I run exiftool on it, I get these (amongst other rows):
So that considers it a JPEG, but with MPO stuff. Our |
Duplicate of #1138? |
The code is not incorrect to recognise the photo as an MPO given there are no well-defined standards. There is still the design problem of how the API can answer the question ‘Is this a JPEG?’ given that merely checking whether the |
This is still broken |
The comment from @JamesJGarner is addressed in #4603 |
If I load a JPEG from my camera (a Panasonic DSC GX7) the format is reported as MPO not JPEG. The
seek
method erroneously allows me to select the nonexistent second frame. For example:I discovered this because our site checks uploads are JPEGs and the check failed because the format is returned as
MPO
.Given how haphazardly image metadata formats are specified and implemented it is possible that Panasonic’s JPEGs do in fact report 2 frames for some reason. In this case it might be worth detecting this case because the second frame does not appear to exist.
The text was updated successfully, but these errors were encountered: