Exchangeable Image File abbreviated as (EXIF) is a format that is standard for storing information in digital photographs. Almost all new digital cameras, including the cameras on the mobile phones use the EXIF annotation. The EXIF stores an array of information like shutter speed, exposure, compensation, flash used or not, ISO number, aperture, focal length, date and time when the image was taken, whitebalance, lenses that were used, the resolution of the image and many other significant details that can the useful in many ways.
The most amazing feature about the EXIF file is that it stores the information about the location, where the image was clicked. The EXIF data file contains the GPS coordinates of the image captured from the iPhone's camera. It can be tagged on any map including the google maps.
The code given below will access the EXIF file of the image stored in the photo gallery and provide the programmer with the date and time when the photo was taken and the GPS coordinates of the location where the pic was clicked.
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo {
NSLog(@"image picked %@ with info %@", image, editingInfo);
NSData* jpegData = UIImageJPEGRepresentation (image,0.5);
EXFJpeg* jpegScanner = [[EXFJpeg alloc] init];
[jpegScanner scanImageData: jpegData];
EXFMetaData* exifData = jpegScanner.exifMetaData;
EXFJFIF* jfif = jpegScanner.jfif;
EXFTag* tagDefinition = [exifData tagDefinition: [NSNumber numberWithInt:EXIF_DateTime]];
EXFTag* latitudeDef = [exifData tagDefinition: [NSNumber numberWithInt:EXIF_GPSLatitude]];
EXFTag* longitudeDef = [exifData tagDefinition: [NSNumber numberWithInt:EXIF_GPSLongitude]];
id latitudeValue = [exifData tagValue:[NSNumber numberWithInt:EXIF_GPSLatitude]];
id longitudeValue = [exifData tagValue:[NSNumber numberWithInt:EXIF_GPSLongitude]];
id datetime = [exifData tagValue:[NSNumber numberWithInt:EXIF_DateTime]];
id t = [exifData tagValue:[NSNumber numberWithInt:EXIF_Model]];
The programmer can then pass on these coordinates to the location manager and can add an annotation on the given coordinates, which will drop a pin and display the location where the pic was taken along with the date and time when it was taken.
0 Comment(s)