Adobe AIR CameraUI照片方向 [英] Adobe AIR CameraUI photo orientation

查看:115
本文介绍了Adobe AIR CameraUI照片方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在尝试使用CameraUI类拍照时,某些Android设备出现问题。

Im having some issues some Android devices when trying to take a photo using CameraUI class.

我的AIR应用程序仅为纵向autoOrients = false,但由于某些原因,当以纵向拍摄照片时,图像将向右旋转90度。

My AIR app is portrait only autoOrients = false, but for some reason, when taking a photo in portrait orientation, the image will return as rotated 90 degrees to the right.

这仅发生在Samsung S6上,例如在HTC M8上不发生。

This happens only on Samsung S6, but doesnt for example on HTC M8.

是否已解决此问题,或者这只是Adobe错误库中的永恒错误之一?

Is there a fix to this problem or is this just one of the eternal bugs in Adobe bugbase?

推荐答案

Android的相机图像内置了GPS位置,方向等信息,这是我最好的选择吗?名为可交换图像文件(Exif)的信息。
捕获图像时,它将与这些信息一起保存在jpg文件中,但图像可能会以意外的方向保存在驱动器上。

Androids camera images has built in information like GPS location, Orientation and more information named Exchangeable Image File (Exif). When you capture an image, it will save with those information in the jpg file but the image may save in an unexpected orientation on drive.

因此,解决方案:

1-将Exif编码器库添加到您的项目中,像这样:
https://github.com/cantrell/ExifExample
2-在加载图像字节后,使用类似此功能的图像来控制图像方向

1- Add an Exif encoder library to your project like this one: https://github.com/cantrell/ExifExample 2- Use something like this function to control the Image orientation after loading the image bytes:

       /**1: normal<br>
        3 rotated 180 degrees (upside down)<br>
        6: rotated 90 degrees CW<br>
        8: rotated 90 degrees CCW<br>
        9: unknown<br>
        */
    public static function getOrientation(ImageBytes:ByteArray):uint
    {
        var exif:ExifInfo = new ExifInfo(ImageBytes);
        if(exif.ifds != null)
        {
            var ifd:IFD = exif.ifds.primary ;
            var str:String = "";
            for (var entry:String in ifd) {
                if(entry == "Orientation"){
                    str = ifd[entry];
                    break;
                }
            }
            return uint(str);
        }
        else
        {
            return 9 ;
        }
    }

这篇关于Adobe AIR CameraUI照片方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆