views:

1205

answers:

3

Is it possible, in an iPhone app, to extract location information (geocode, I suppose it's called) from a photo taken with the iPhone camera?

If there is no API call to do it, is there any known way to parse the bytes of data to extract the information? Something I can roll on my own?

+3  A: 

Unfortunately no.

The problem is thus;

A jpeg file consists of several parts. For this question the ones we are interested in are the image data and the exif data. The image data is the picture and the exif data are where things like geocoding, shutter speed, camera type and so on are stored.

A UIImage (and CGImage) only contain image data, no tags.

When the image picker selects an image (either from the library or the camera) it returns a UIImage, not a jpeg. This UIImage is created from the jpeg image data, but the exif data in the jpeg is discarded.

This means this data is not in the UIImage at all and thus is not accessible.

Andrew Grant
Is there any known way to parse the bytes of data to extract the information? Perhaps not an API call, but something I can roll on my own?
bpapa
Afraid not, I've clarified the answer to explain why.
Andrew Grant
This isn't strictly true. It's possible, as some apps (such as Mobile Photos and PixelPipe) seem to be able to manage it. I still haven't found any sample code though.
tomtaylor
+4  A: 

Look here. It is a library you can use to do what you want: http://iphone-exif.googlecode.com/files/iphone-exif-guide-0.8.pdf

Jasper
A: 

Check out this tutorial made by ben nadel: see video

sanne