Open ldalzottomp opened 3 weeks ago
I use BitmapFactory.decodeFile
to get the width and height of the photo after capturing.
According to BitmapFactory.Options.outHeight
;
The resulting height of the bitmap. If inJustDecodeBounds is set to false, this will be height of the output bitmap after any scaling is applied. If true, it will be the height of the input image without any accounting for scaling.
We set inJustDecodeBounds
to true
, so this should be "the height of the input image without any accounting for scaling." - does Image.getSize
maybe perform display scaling already?
@mrousavy I tried to debug both source code and didn't any valid conclusion. I noted indeed that when react load the Image there is a resize done only for the LandscapeLeft picture. (done here in the RN code). But why would it happen only for this orientation ? Other three looks fine. It has to be something else I feel.
The same app login in V3 works fine.
I noted that when react load the exif to get the orientation, I have the following results.
public static final int ORIENTATION_NORMAL = 1;
public static final int ORIENTATION_ROTATE_180 = 3;
public static final int ORIENTATION_ROTATE_270 = 8;
public static final int ORIENTATION_ROTATE_90 = 6;
ORIENTATION_ROTATE_90 -> Portrait
ORIENTATION_ROTATE_NORMAL -> LandscapeLeft
ORIENTATION_ROTATE_180 -> LandscapeRight
ORIENTATION_ROTATE_270 -> PortraitUpsideDown
Which is different from V3 :
ORIENTATION_ROTATE_180 -> LandscapeLeft
ORIENTATION_ROTATE_NORMAL -> LandscapeRight
Exif metadata are read here in react
hmm, interesting. Orientation is still something that's not fully supported (See #1891) - so I don't really have a lot of insights, other than that I'd be confident that CameraX' EXIF writer is probably a bit more battletested than the one I wrote in V3. So V4 should be correct, anything that's incorrect should probably be reported in the Google Issue Tracker, they test on a lot of devices. I only have 3 phones.
What's happening?
Hello!
In my recent try to update to the latest v4.0.1. I am encountering a weird issue when the orientation prop is set to landscape-left. The image dimension produced by camera.takePhoto() doesn't match the output of the react-native api Image.getSize. I suspect that wrong metadata are set in this case? All ohter values for the orientation props are okay.
You can check the following video that showcase the issue. Writtent in red :
Note: I reproduce in the example app if I change the orientation prop and console log the Image.getSize output.
https://github.com/mrousavy/react-native-vision-camera/assets/91324462/14a70f7e-b6d8-417e-888a-2e61db26378e
Reproduceable Code
Relevant log output
Camera Device
Device
Galaxy S9 - SM-G960F (Android 10, One UI 2.5)
VisionCamera Version
4.0.1
Can you reproduce this issue in the VisionCamera Example app?
Yes, I can reproduce the same issue in the Example app here
Additional information