The November 2010 Blog
send me a comment

GPS Location On JPG Photos (Wednesday, Nov 17)
[ permalink ] [ e-mail me ] [ ]

One of the things I discussed in my "Location Services" presentation at IamLUG and ILUG this year is the fact that you can often get the GPS coordinates of a cell phone photo that someone has sent you, to not only tell when a photo was taken, but where. That's because JPEG photos have something called EXIF metadata embedded in them -- type of camera, f-stop setting, etc. -- and many cell phones also add the GPS location to their pictures as a geotag.

I also went on to say that a lot of online photo-sharing sites are removing the EXIF data of uploaded photos now, due in part to things like celebrity stalking stories and general privacy concerns. When I mentioned this in my presentation last week, someone in the audience shook their head and told me I was wrong.

So I ran a test (which I had run before, but I felt like I needed to try again).

Here's a photo I took with my iPhone at Giant's Causeway last week, during a short sidetrip that I went on with Jamie Magee and Rob Novak:

Giants Causeway picture from my iPhone

I uploaded the picture to Twitpic, Yfrog, and Facebook, and then redownloaded the highest resolution picture from each site. Even though resizing a picture will not necessarily get rid of EXIF data (depends on how you do it), I figured that if anything still had the original metadata, the highest rez pictures would. And before you ask, I intentionally skipped testing Flickr because they already have very specific geotag privacy options you can set for your account.

From there, I downloaded the excellent public domain Metadata Extractor library and wrote the following Java code to call it:

public String getMetadata (String fileName) {
    // get EXIF metadata from JPG photos, using Metadata Extractor
    // library from http://drewnoakes.com/code/exif
    StringBuffer sb = new StringBuffer();
    sb.append(fileName).append("\n");
    
    try {
        File jpegFile = new File( fileName );
        Metadata metadata = JpegMetadataReader.readMetadata( jpegFile );
        Iterator directories = metadata.getDirectoryIterator();
        
        while ( directories.hasNext() ) {
            com.drew.metadata.Directory directory = 
                (com.drew.metadata.Directory)directories.next();
            Iterator tags = directory.getTagIterator();
            while ( tags.hasNext() ) {
                Tag tag = (Tag)tags.next();
                sb.append(tag).append("\n");
            }
        }
    } catch (Exception e) {
        sb.append(e.getMessage()).append("\n");
    }
    
    return sb.toString();
}

Running this method against the original picture and all the downloaded pictures, I got these results:

c:/temp/gc/gcIphone-Original.jpg
[Exif] Make - Apple
[Exif] Model - iPhone
[Exif] X Resolution - 72 dots per inch
[Exif] Y Resolution - 72 dots per inch
[Exif] Resolution Unit - Inch
[Exif] Software - 3.1.3
[Exif] Date/Time - 2010:11:13 15:15:09
[Exif] YCbCr Positioning - Center of pixel array
[Exif] F-Number - F2.8
[Exif] Exposure Program - Program normal
[Exif] Exif Version - 2.21
[Exif] Date/Time Original - 2010:11:13 15:15:09
[Exif] Date/Time Digitized - 2010:11:13 15:15:09
[Exif] Aperture Value - F2.8
[Exif] Metering Mode - Average
[Exif] Flash - Flash did not fire
[Exif] FlashPix Version - 1.00
[Exif] Color Space - sRGB
[Exif] Exif Image Width - 600 pixels
[Exif] Exif Image Height - 800 pixels
[Exif] Sensing Method - One-chip color area sensor
[Exif] Exposure Mode - Auto exposure
[Exif] White Balance - Auto white balance
[GPS] GPS Latitude Ref - N
[GPS] GPS Latitude - 55"12'23.999977
[GPS] GPS Longitude Ref - W
[GPS] GPS Longitude - 6"38'54.00009
[GPS] GPS Time-Stamp - 15:14:53 UTC
[Jpeg] Data Precision - 8 bits
[Jpeg] Image Height - 800 pixels
[Jpeg] Image Width - 600 pixels
[Jpeg] Number of Components - 3
[Jpeg] Component 1 - Y component: Quantization table 0, Sampling factors 2 horiz/2 vert
[Jpeg] Component 2 - Cb component: Quantization table 1, Sampling factors 1 horiz/1 vert
[Jpeg] Component 3 - Cr component: Quantization table 1, Sampling factors 1 horiz/1 vert

c:/temp/gc/gcTwitpic.jpg
[Exif] Orientation - Top, left side (Horizontal / normal)
[Jpeg] Data Precision - 8 bits
[Jpeg] Image Height - 640 pixels
[Jpeg] Image Width - 480 pixels
[Jpeg] Number of Components - 3
[Jpeg] Component 1 - Y component: Quantization table 0, Sampling factors 2 horiz/2 vert
[Jpeg] Component 2 - Cb component: Quantization table 1, Sampling factors 1 horiz/1 vert
[Jpeg] Component 3 - Cr component: Quantization table 1, Sampling factors 1 horiz/1 vert

c:/temp/gc/gcYfrog.jpg
[Exif] Orientation - Top, left side (Horizontal / normal)
[Jpeg] Data Precision - 8 bits
[Jpeg] Image Height - 640 pixels
[Jpeg] Image Width - 480 pixels
[Jpeg] Number of Components - 3
[Jpeg] Component 1 - Y component: Quantization table 0, Sampling factors 2 horiz/2 vert
[Jpeg] Component 2 - Cb component: Quantization table 1, Sampling factors 1 horiz/1 vert
[Jpeg] Component 3 - Cr component: Quantization table 1, Sampling factors 1 horiz/1 vert

c:/temp/gc/gcFacebook.jpg
[Jpeg] Data Precision - 8 bits
[Jpeg] Image Height - 720 pixels
[Jpeg] Image Width - 540 pixels
[Jpeg] Number of Components - 3
[Jpeg] Component 1 - Y component: Quantization table 0, Sampling factors 2 horiz/2 vert
[Jpeg] Component 2 - Cb component: Quantization table 1, Sampling factors 1 horiz/1 vert
[Jpeg] Component 3 - Cr component: Quantization table 1, Sampling factors 1 horiz/1 vert

So, to me it looks like the EXIF data (including geotag info) has been stripped from the uploaded photos, at least on those services. However, it's entirely possible that I'm doing it wrong and the information can still be had somewhere. Or maybe it depends on which tool you use to upload your pictures. In any case, there's some code you can play with.

ILUG 2010: Fantastic Time (Sunday, Nov 14)
[ permalink ] [ e-mail me ] [ ]

ILUG 2010 in Belfast was, once again, a fantastic event with flawless execution by "The Green Shirts". A few thoughts off the top of my head before I succumb to jetlag and collapse.

Bye Bye Bloglines (Saturday, Nov 6)
[ permalink ] [ e-mail me ] [ ]

According to the Bloglines home page, the Bloglines service will stay up for a while longer under new management (it was supposed to close shop on Nov. 1). I've already exported all my info and transitioned to Google Reader though, so it's the end of an era for me.

Bloglines was actually the first cloud service I ever used. Other than my personal email, I guess, which has always been "in the cloud". It's interesting that with OPML I could just move from one cloud to another -- except for my Saved Articles; I had to copy all those links manually:

It's a pretty random list of links, I know. Just stuff I kept around.

Spidey & Hulk (Friday, Nov 5)
[ permalink ] [ e-mail me ] [ ]

Title, picture, and link stolen shamelessly from Erik's Tumbles:

Spidey vs. Hulk, by manarama.deviantart.com

I'm not usually one to desire pieces of art, but this one speaks to me.