我正在使用 Adobe Air 开发 iOS8 iPhone 应用程序,我想从 CameraRoll 加载的图像中读取 image orientation
的 EXIF 数据。
我正在使用这个 AS3 EXIF 库:https://github.com/bashi/exif-as3
提供的示例适用于通过 URLRequest 加载的图像,但不适用于 CameraRoll 加载的图像。 (EXIF 的跟踪 = null
)
这是我的代码:
import jp.shichiseki.exif.*;
var loaderCameraRoll:ExifLoader
var deviceCameraRoll:CameraRoll
function loadImageFromCameraRoll(e:Event=null):void {
deviceCameraRoll = new CameraRoll();
deviceCameraRoll.addEventListener(MediaEvent.SELECT, onSelectCameraRoll);
deviceCameraRoll.browseForImage();
}
function removeBrowseListeners():void {
deviceCameraRoll.removeEventListener(MediaEvent.SELECT, onSelectCameraRoll);
}
function onSelectCameraRoll(event:MediaEvent):void {
var promise:MediaPromise = event.data as MediaPromise;
loaderCameraRoll = new ExifLoader()
loaderCameraRoll.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadedCameraRoll);
loaderCameraRoll.loadFilePromise(promise);
}
function onLoadedCameraRoll(event:Event):void {
trace(loaderCameraRoll.exif.ifds.primary)
}
如何从 CameraRoll 加载的图像中获取 EXIF 方向值?
最佳答案
尝试使用 Native Extenson 这是一个不错的选择:
https://github.com/digicrafts/ANE-ImagePicker
if (AirImagePicker.getInstance().isCameraAvailable())
{
AirImagePicker.getInstance().displayCamera(function(status:String, ...mediaArgs):void {
// Do something with the Media information returned
});
}
// Pick an image from the gallery
if (AirImagePicker.getInstance().isImagePickerAvailable())
{
AirImagePicker.getInstance().displayImagePicker(function(status:String, ...mediaArgs):void {
// Do something with the Media information returned
});
}
关于ios - 从 iOS8 上的 CameraRoll 加载图像读取 EXIF 方向标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27528754/