yasirkula/UnityNativeCamera

Pictures taken using TakePicture has wrong rotation.

Parixit2411 opened this issue · 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

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

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.

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?

Alright, I will use that and check.

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.

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.

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

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