yasirkula / UnityNativeCamera

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

Selfie Camera image upside down #118

Open DevSpur opened 5 months ago

DevSpur commented 5 months ago

When using the selfie camera after taking photo the image loads upside down, I need to upload this image to a server and it needs to be the right way up.

yasirkula commented 5 months ago

Mobile cameras insert EXIF metadata into those images, stating how many degrees to rotate an image to display it properly. If an image viewer respects that EXIF metadata, the image will be displayed correctly. For example, I'd expect all mobile devices to display those images correctly. However, you may want to hardcode that rotation to the image to support all image viewers. One way to achieve this with NativeCamera is to call LoadImageAtPath to load the image into a Texture2D and then save it as PNG or JPEG via texture.EncodeToPNG/EncodeToJPG. The resulting image should have correct orientation.