-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Out-of-order EXIF tags generated by buggy Samsung devices are ignored #3947
Comments
Please provide a specific image and actual values that allow someone else to reproduce. Line 5 in 0dcc7d5
|
Email sent with all information. |
It looks like the image you've provided contains invalid EXIF:
Some of the other metadata suggests this image was generated by a Samsung device, which are notorious for terrible firmware, and this would appear to be another example of it. |
Thanks for the response and the insights. How do the browsers and other tools deal with it? Because there it seems to work there and I cannot change, that our customers use Samsung devices or other Software, that might create such data. Do you think it's possible to apply more relaxed rules for parsing like other Software does? |
It's possible it might relate to this logic in libvips, but I guess changing this behaviour could then break something else. |
Ok, thanks for digging in the sourcecode. I am thinking about, what I could do to drive this issue forward. I think sharp and libvips should be able to process all common metadata in the same way browsers and other Software can do. What do we need to make this happen? |
One other thought: Would it be better to manually read the Orientation flag? I tried exiftool and I tried another node library and both read the orientation flag as 270 degree clockwise. So in the code example I would call rotate() not with the auto value, but always provide the value, I manually extracted. |
I had a quick look and cannot see any way of coercing libexif to process out of order tags. For the image you provided, the
So yes, as you suggest, perhaps pre-process images that might contain invalid EXIF with another tool first. |
I tried different libraries and also exiftool and all were able to detect the correct orientation. Only libvips seems to fail. |
I will try the route to determine the orientation with another library and pass it explicitely to rotate(). This should fix this. I still think, libvips should also support this out of the box, because it makes the library harder to use, if we need to add third party libs for basic features. However I am not sure, if the issue here is the right on to track this (or at least request this). What do you think? |
From what I can tell, this is libexif behaviour. I guess the next step would be for someone to produce a small program that proves this using only libexif, which might then also provide motivation and/or a test case for changing libexif to allow out-of-order tags (perhaps as part of its existing |
Possible bug
Is this a possible bug in a feature of sharp, unrelated to installation?
npm install sharp
completes without error.node -e "require('sharp')"
completes without error.If you cannot confirm both of these, please open an installation issue instead.
Are you using the latest version of sharp?
sharp
as reported bynpm view sharp dist-tags.latest
.If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.
If you are using another package which depends on a version of
sharp
that is not the latest, please open an issue against that package instead.What is the output of running
npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp
?What are the steps to reproduce?
We are running a community, where people an upload profile pictures. In the frontend they can select the picture and crop it, so the result is expected by the user. This works 99% of the time, but we get some pictures, where rotate().extract(crop) does not rotate the picture properly and it fails with bad extract area. Browsers and the default image tool on MacOS rotate these pictures properly.
Since these pictures are private, I would like to send an example with the expected crop coordinates on a private channel to verify, if the picture is detected wrong or if there is a bug in our code.
What is the expected behaviour?
It should rotate the picture according to the metadata correctly and extract the correct crop.
Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem
Please provide sample image(s) that help explain this problem
As mentioned above due to privacy concerns, I would like to send the picture via a private channel. Thanks in advance!
The text was updated successfully, but these errors were encountered: