yasirkula / UnityNativeCamera

A native Unity plugin to take pictures/record videos with device camera on Android & iOS
MIT License
614 stars 71 forks source link

Pictures taken using TakePicture has wrong rotation. #90

Open Parixit2411 opened 2 years ago

Parixit2411 commented 2 years ago

Description of the bug

I am using TakePicture to click pictures. Once the pic is clicked it has the wrong rotation. ImageProperties orientation shows unknown.

Reproduction steps

Simply use the TakePicture function with callback parameter and maxSize parameter.

Platform specs

Please provide the following info if this is a Unity 3D repository.

yasirkula commented 2 years ago

Does NativeCamera.LoadImageAtPath also return a Texture with wrong orientation?

Parixit2411 commented 2 years ago

Yes, LoadImageAtPath is also returning texture with the wrong orientation. I have tested it on one other device and it is working fine on it. So I think it might be on Android OS 10 or my particular device.

yasirkula commented 2 years ago

I'd like to believe that it's a device-specific issue. If it were an Android 10 issue, I think other similar issues would've arrived by now. Could you replace NativeCamera.aar with the one inside this zip archive and see if it resolves the issue on the problematic device?

Parixit2411 commented 2 years ago

Alright, I will use that and check.

ernonemacher commented 2 years ago

Facing the same issue, replacing the NativeCamera.aar didn't change anything. ImageProperties orientation returns Rotate180.

I am testing in a Redmi Note 8, Android 10.

Parixit2411 commented 2 years ago

As far as I have tested, it happens on some devices with Android 10. So as mentioned earlier, it might be a device issue. Maybe you should try to test it on another device.

yasirkula commented 2 years ago

@ernonemacher If you save the image to Gallery with NativeGallery, is it displayed correctly there? If it does, does loading the image from gallery with NativeGallery.GetImageFromGallery and NativeGallery.LoadImageAtPath return a correctly oriented Texture?

P.S. You may also use the device's file browser to preview the image file directly. It should be located inside temporaryCachePath which is located inside storage/Android/package_name/cache.

ernonemacher commented 2 years ago

Thanks @yasirkula for your support, it worked. I was using File.ReadAllBytes, changing to NativeCamera.LoadImageAtPath worked. It wasn't necessary to save the image in the gallery.

Parixit2411 commented 2 years ago

Yes

On Sun, 13 Mar, 2022, 8:55 pm Süleyman Yasir KULA, @.***> wrote:

Does NativeCamera.LoadImageAtPath also return a Texture with wrong orientation?

— Reply to this email directly, view it on GitHub https://github.com/yasirkula/UnityNativeCamera/issues/90#issuecomment-1066124566, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHQWJFEIEXSV4TS3OQSMW5DU7YCFBANCNFSM5QTOIKMA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

yasirkula commented 2 years ago

@Parixit2411 Can you replace NativeCamera.aar with the one inside this zip archive and paste the logcat logs that start with "===" after taking a picture with the camera?