How to capture EXIF ​​metadata images (ISO, f-stop, exposure, etc.) from a photo in iOS?

In earlier versions of iOS, I was able to get the EXIF ​​dictionary with PLCameraController via

 -(void)cameraController:(id)sender tookPicture:(UIImage*)picture withPreview:(UIImage*)preview jpegData:(NSData*)rawData imageProperties:(id)imageProperties 

This no longer works in iOS 4+.

How can I get EXIF ​​metadata in iOS, such as ISO number, F number, etc.?

+4
source share
1 answer

As in iOS 4.1, you can get image metadata for a photo taken using the UIImagePickerControllerMediaMetadata key.

 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { NSDictionary *metadataDictionary = (NSDictionary *)[info valueForKey:UIImagePickerControllerMediaMetadata]; // do something with the metadata } 

If you register the output [info description] , you can see all the metadata available -

 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; }; }; 
+3
source

Source: https://habr.com/ru/post/1314554/


All Articles