UnityNativeCamera icon indicating copy to clipboard operation
UnityNativeCamera copied to clipboard

Pictures taken using TakePicture has wrong rotation.

Open Parixit2411 opened this issue 3 years ago • 10 comments

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.

  • Unity version: 2020.3.29f1
  • Platform: Android, not tested on any other platform
  • Device: Nokia 6.1 plus OS 10
  • How did you download the plugin: Asset Store

Parixit2411 avatar Mar 13 '22 14:03 Parixit2411

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

yasirkula avatar Mar 13 '22 15:03 yasirkula

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.

Parixit2411 avatar Mar 13 '22 16:03 Parixit2411

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?

yasirkula avatar Mar 13 '22 16:03 yasirkula

Alright, I will use that and check.

Parixit2411 avatar Mar 13 '22 16:03 Parixit2411

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.

ernonemacher avatar May 20 '22 11:05 ernonemacher

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.

Parixit2411 avatar May 20 '22 11:05 Parixit2411

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

yasirkula avatar May 20 '22 12:05 yasirkula

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.

ernonemacher avatar May 20 '22 15:05 ernonemacher

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: @.***>

Parixit2411 avatar Oct 11 '22 06:10 Parixit2411

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

yasirkula avatar Oct 15 '22 09:10 yasirkula