jkwiecien / EasyImage

Library for picking pictures from gallery or camera
1.74k stars 303 forks source link

Image orientation problem #43

Open Mitchizuky opened 8 years ago

Mitchizuky commented 8 years ago

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.

georgethms10 commented 8 years ago

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

yayaa commented 8 years ago

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 ?

dgngulcan commented 8 years ago

+1

jfbibeau commented 8 years ago

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.

maksim88 commented 8 years ago

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.

yayaa commented 8 years ago

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

gogui63 commented 8 years ago

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

dgngulcan commented 8 years ago

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

gogui63 commented 8 years ago

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

taig commented 7 years ago

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!

vivchar commented 7 years ago

It will be fixed in future?

yayaa commented 7 years ago

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

ghost commented 7 years ago

Any progress with this issue?

qadirsuh commented 7 years ago

@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?

winseyli commented 7 years ago

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

shimiuh commented 6 years ago

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

dgngulcan commented 6 years ago

@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);
shimiuh commented 6 years ago

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" notifications@github.com 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 .

jkwiecien commented 6 years ago

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

babedev commented 6 years ago

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

fluxcapacit commented 6 years ago

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);

ChiangChu commented 4 years ago

Any updates on solving this problem.