EasyImage icon indicating copy to clipboard operation
EasyImage copied to clipboard

Image orientation problem

Open Mitchizuky opened this issue 8 years ago • 22 comments

Hello,

this library is really good and saves a lot of time but i found an issue with image orientation on Samsung phones. All pictures taken in portrait are saved rotated 90 degrees. When i take picture in landscape mode everything is fine. This is an issue that i found only on Samsung phones so far.

I'm using Samsung S3.

Mitchizuky avatar Feb 24 '16 13:02 Mitchizuky

Yes the library just picks the image, Would be nice if the orientation changes and has an option to compress images without losing quality

georgethms10 avatar Mar 12 '16 09:03 georgethms10

I also have the same concerns, but i guess providing auto-rotation is quite not possible to support for all devices and all applications. Because it is actually not on device but also applications.

For instance, i have Sony Xperia Z3 and when i'm trying to get photo with default camera: it's not in the right rotation it should be, but when i try to pick with different camera application, it receives as it should be, just no problem.

So i'm thinking about implementing another step to display as a preview and put a rotate button on that screen. I don't know if that would be possible to implement such thing as option in library as well @jkwiecien ?

yayaa avatar Mar 18 '16 09:03 yayaa

+1

dgngulcan avatar Apr 27 '16 13:04 dgngulcan

Hmm I'm hitting the same problem. Anything saved using the camera doesn't appear to have the Exif attribute TAG_ORIENTATION set so it's impossible to know the orientation of the picture after it's saved.

Edit: I take that back - TAG_ORIENTATION is always 0, but the width/height seems ok. Nothing wrong with the library.

jfbibeau avatar May 09 '16 15:05 jfbibeau

There is also an orientation that might be set inside MediaStore.Images.Media.ORIENTATION. So some devices set the orientation inside ExifInterface.TAG_ORIENTATION, some of them inside the MediaStore.

maksim88 avatar May 12 '16 07:05 maksim88

I was checking some other functionalities to include into my application and faced a library doesn't have this issue and digged little bit into and saw that there is a code snipped by Google to get exif information amd decide the orientation of the image... You may consider it: https://github.com/Yalantis/uCrop/blob/master/ucrop/src/main/java/com/yalantis/ucrop/util/ImageHeaderParser.java

yayaa avatar May 27 '16 16:05 yayaa

I've this issue too, can you fix it ?

gogui63 avatar Jun 20 '16 20:06 gogui63

I found out the orientation is right when you don't turn it into bitmap but use is as file.

dgngulcan avatar Jun 21 '16 08:06 dgngulcan

I use the file (file.getPath) and pass to an other activity and display with picasso " Picasso.with(mContext).load(new File(mPathPhoto))....."

gogui63 avatar Jun 26 '16 17:06 gogui63

I just want to confirm that the solution shown by @yayaa works really well to extract the orientation from the image and then rotate it accordingly!

taig avatar Nov 29 '16 12:11 taig

It will be fixed in future?

vivchar avatar Mar 23 '17 05:03 vivchar

By the way, with Support Library 25.2.0 Google introduce ExifInterface can be used to fix this issue.

yayaa avatar Mar 23 '17 07:03 yayaa

Any progress with this issue?

ghost avatar May 25 '17 21:05 ghost

@dgngulcan In a comment you have said that I found out the orientation is right when you don't turn it into bitmap but use is as file.

I want to set the image taken from camera into my imageview. how to load image without converting them into bitmap?

qadirsuh avatar Jun 13 '17 09:06 qadirsuh

I have the same issue. Would be appreciated if this can be fixed.

winseyli avatar Jul 05 '17 21:07 winseyli

I have the same problem for me a fast fix with an image library will not work . i need to send the image not just display in an ImageView please let us know if you have intentions on fixing this? thanks shimi

shimiuh avatar Oct 30 '17 14:10 shimiuh

@qadirsuh sorry for the late response. One way to do is to give the file directly to the image loading library such as Glide such;

Glide.with(context)
    .load(new File(imageUri.getPath()))
    .into(imageView);

dgngulcan avatar Oct 30 '17 15:10 dgngulcan

That will not help me i need to send the image to a web site for image recognition. I need the image saved on file with the right rotation Thanks

On Oct 30, 2017 17:42, "Dogan Gulcan" [email protected] wrote:

@qadirsuh https://github.com/qadirsuh sorry for the late response. One way to do is to give the file directly to the image loading library such as Glide such;

Glide.with(context) .load(new File(imageUri.getPath())) .into(imageView);

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jkwiecien/EasyImage/issues/43#issuecomment-340485232, or mute the thread https://github.com/notifications/unsubscribe-auth/ADfXYVMSM98WkBqEAMOy2UH20_x1Q_mpks5sxe5cgaJpZM4Hhp_7 .

shimiuh avatar Oct 30 '17 17:10 shimiuh

I can't reproduce the problem on the sample app. Can someone help me with that? DOes that happen on sample app?

jkwiecien avatar Nov 03 '17 10:11 jkwiecien

I tested on Galaxy S8 with portrait mode but always got landscape orientation.

babedev avatar Jan 31 '18 04:01 babedev

Same issue on Samsung Galaxy S7. Here's how I got the degrees you can rotate after decoding to bitmap from the returned file path.

android.support.media.ExifInterface exif = new android.support.media.ExifInterface(filePath); int rotation = exif.getAttributeInt(android.support.media.ExifInterface.TAG_ORIENTATION, android.support.media.ExifInterface.ORIENTATION_NORMAL);

fluxcapacit avatar Feb 13 '18 19:02 fluxcapacit

Any updates on solving this problem.

ChiangChu avatar May 18 '20 10:05 ChiangChu