在早期版本的 iOS 中,我可以通过 PLCameraController
获取 EXIF 字典
-(void)cameraController:(id)sender
tookPicture:(UIImage*)picture
withPreview:(UIImage*)preview
jpegData:(NSData*)rawData
imageProperties:(id)imageProperties
这不再适用于 iOS 4+。
如何在 iOS 中获取 EXIF 元数据,例如 ISO 编号、F 编号等?
最佳答案
从 iOS 4.1 开始,您可以获取使用 UIImagePickerControllerMediaMetadata
键拍摄的照片的图像元数据。
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSDictionary *metadataDictionary =
(NSDictionary *)[info valueForKey:UIImagePickerControllerMediaMetadata];
// do something with the metadata
}
如果您记录 [info description]
的输出,您可以看到所有可用的元数据 --
UIImagePickerControllerMediaMetadata = {
DPIHeight = 72;
DPIWidth = 72;
Orientation = 6;
"{Exif}" = {
ApertureValue = "2.970853654340484";
ColorSpace = 1;
DateTimeDigitized = "2011:01:21 06:20:36";
DateTimeOriginal = "2011:01:21 06:20:36";
ExposureMode = 0;
ExposureProgram = 2;
ExposureTime = "0.01666666666666667";
FNumber = "2.8";
Flash = 32;
FocalLength = "3.85";
ISOSpeedRatings = (
100
);
MeteringMode = 1;
PixelXDimension = 2048;
PixelYDimension = 1536;
SceneType = 1;
SensingMethod = 2;
Sharpness = 1;
ShutterSpeedValue = "5.906892602837797";
SubjectArea = (
1023,
767,
614,
614
);
WhiteBalance = 0;
};
"{TIFF}" = {
DateTime = "2011:01:21 06:20:36";
Make = Apple;
Model = "iPhone 3GS";
Software = "4.2.1";
XResolution = 72;
YResolution = 72;
};
};
关于ios - 如何从 iOS 中的照片中获取图像 EXIF 元数据(ISO、f-stop、曝光等)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3166507/