bamlab / react-native-image-resizer

🗻 Resize local images with React Native
MIT License
1.59k stars 338 forks source link

Fix: rotation on some android devices #398

Closed MrLibya closed 2 months ago

MrLibya commented 4 months ago

Error

On some android devices the photo is rotated

Solution

This caused by lack of some exif rotation is not read on creating the new bitmap for rotation.

MrLibya commented 4 months ago

@taboulot

taboulot commented 3 months ago

Hi @MrLibya do you a device example on which it does not work ?

taboulot commented 3 months ago

@MrLibya

I think I finally understand the problem. I've detailed it in this issue #402. Unfortunately your PR does not fix the problem (on both iOS & Android) has it does not take into account the flip operation.

With your fix if the image has an exif orientation value = 4 :

image

I think we will have this result:

image

Instead of this one:

image
MrLibya commented 3 months ago

Sorry for not providing example code I was busy, I'll look into that and see what I can do

MrLibya commented 3 months ago

@taboulot I've added handing for mirrored ( flipped ) image exif, I've used those images to test on https://github.com/recurser/exif-orientation-examples

Code test: https://gist.github.com/MrLibya/cabea9cbbb776cc5e77bf1a56df2d8d2

felansu commented 3 months ago

i need this!!

MrLibya commented 2 months ago

@taboulot anything else needed?

taboulot commented 2 months ago

@MrLibya

I left 2 comments. I'm on vacation, and I'm going to stay that way for a while. My response times are therefore variable, but I will remain available for the next few days.

MrLibya commented 2 months ago

@taboulot Done ✅

taboulot commented 2 months ago

@MrLibya

Perfect 👌 I will release it in few minutes