-
Notifications
You must be signed in to change notification settings - Fork 797
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
ExifUtil.getExifOrientation does not work for images containing other exif data alongwith Orientation #108
Comments
With most of our users using mobile phones to take pictures now, this is becoming a serious issue. Is there anyone still maintaining this library? Would you accept pull requests? |
@jheander Thank you for the comment. Do you have any more information regarding which mobile phones are exhibiting this issue? (Are they happening in particular series of phones? Particular OS or version? etc?) If you have any examples of JPEGs that have the same issue as the one described here, it could be helpful for diagnosis. |
We've experienced this issue with photos from the Samsung SM-G960U. I would share the photo but I am not comfortable sharing it with the GPS location in the EXIF data and if I remove just the location from the EXIF data with Preview on Mac OS the issue is no longer reproducible with the modified image. |
Just fake your location before taking the picture, using for example this
app: https://play.google.com/store/apps/details?id=com.lkr.fakelocation
Den tor 15 nov. 2018 18:47Dan Sheline <notifications@github.com> skrev:
… We've experienced this issue with photos from the Samsung SM-G960U.
I would share the photo but I am not comfortable sharing it with the GPS
location in the EXIF data and if I remove just the location from the EXIF
data with Preview on Mac OS the issue is no longer reproducible with the
modified image.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#108 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABoFVYCMY2JCOcDYhnvcUbjoLpx4Um6rks5uvaixgaJpZM4LSoQX>
.
|
I have a small web app that uses Thumbnailator, and have a lot of mobile photo uploads. It's been running for a few years and have handled resize with correct orientation according to EXIF data, but it fails portrait images with Asus Zenphone 5. I suspect that this is caused by this bug. I'm attaching two sample images, one taken in portrait mode, and one landscape. |
I've experienced this issue with Samsung SM-T825 I've extracted the EXIF information of two images, I hope it helps the diagnosis
|
it happen at Xiaomi 8 SE too. |
After a little bit of research, this appears to be an "issue" with the Java Image I/O's JRE-bundled JPEG reader being very strict about the well-formedness of the Exif metadata. As mentioned in the comment to this Stackoverflow question, using the TwelveMonkeys JPEG support does indeed cause this issue to go away. To "fix" this issue in Thumbnailator would mean that I'd have to implement a lower-level Exif reader that doesn't rely on the JPEG reader implementation exposed through Java Image I/O, which isn't trivial, but would require a little bit of work. For the time-being, I'd recommend invoking the TwelveMonkeys JPEG support which avoids the JFIF APP0 must be first marker after SOI from happening. It's a fairly trivial process if you're using Maven. Basically, just include the artifact in your |
Even when we include TwelveMonkeys it is not enough for ExifUtil.getExifOrientation to work reliably.
|
I have an image of 622 X 1280 clicked from Samsung S9 mobile. When I am trying to resize it with I tried including the TwelveMonkeys but still same result. @Emmenemoi Where did you put these methods? |
Just for the record, including TwelveMonkeys JPEG in my deps worked for me...
|
A fix for this issue (workaround for the default JPEG reader's strict behavior) is available in the snapshot repository as |
…putStream`. (#108) The default JPEG reader bundled with the JRE cannot handle JPEG images that doesn't have a JFIF APP0 marker segment as the first one, as some JPEG images will include Exif (APP1) as the first one. This workaround falls back to use Exif data captured from the `InputStream` if the JPEG reader chosen by Image I/O fails to retrieve the Exif data.
Fixed in 0.4.16. |
Expected behavior
Give orientation for all the images with whatever exif data being present
Actual behavior
Currently it accepts only the images which contains EXIF data of orientation alone.
It gives exception
javax.imageio.IIOException: JFIF APP0 must be first marker after SOI
at com.sun.imageio.plugins.jpeg.JPEGMetadata.(Unknown Source)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.getImageMetadata(Unknown Source)
at net.coobird.thumbnailator.util.exif.ExifUtils.getExifOrientation(Unknown Source)
at com.abk.ImageAutoRotate.main(ImageAutoRotate.java:24)
Steps to reproduce the behavior
Use any images taken using a mobile phone and you will face issues
Attached the image for which it gives exception
Environment
JDK 8
The text was updated successfully, but these errors were encountered: