How to extract JPG's Exif rotaion info?; Unityで画像のExif情報を得る方法; Resolved!

  • 別のアセットでAndroid Galleryの画像パスまでは取れる状態になっていた
  • 後はパスから画像を呼んでExifを引き出せればいい
  • こちらのAssetを使った。最初からGalleryにはこれを使っても良さそう。無料

assetstore.unity.com

  • orientationを取って使っている部分のコードは下記
        foreach (var an_media in result.Media)
        {
            Debug.Log("an_media.Type: " + an_media.Type);
            Debug.Log("an_media.Path: " + an_media.Path);
            Debug.Log("an_media.Thumbnail: " + an_media.Thumbnail);

            var info = NativeGallery.GetImageProperties(an_media.Path);
            Debug.Log("Exif info");
            Debug.Log(info.orientation);
            lastLoadedOrientation = info.orientation;
        }
        if(lastLoadedOrientation == NativeGallery.ImageOrientation.Rotate270)
        {
            image = RotateTexture(image, false);
        }

English ver

  • You should use the asset!

assetstore.unity.com

Unityの教科書 Unity 2018完全対応版 2D&3Dスマートフォンゲーム入門講座 (Entertainment&IDEA)

Unityの教科書 Unity 2018完全対応版 2D&3Dスマートフォンゲーム入門講座 (Entertainment&IDEA)