Ever wonder about how much information is stored in your image files beyond the pixels that comprise the images themselves? And what that data might tell about you, your camera, your photographic style, and your location? It just might be a lot more than you ever imagined.
My curiosity about the kind of metadata that was stored inside the photos I've been taking with my iPhone arose only recently. I was filing some of my 2015 family photos and started thinking about how much more complex the jpg format had become since I first did a deep dive into it more than twenty years ago. Why? Because, when I added an image to my Facebook page or opened one up to do a little cropping with Gimp, it was obvious that both Firefox and Gimp knew that some of my images were rotated. That is, I'd taken them with my digital camera (OK, my iphone) turned sideways. This told me, unless these tools were both doing an extremely clever image analysis, 1) that my phone was smarter than I thought as it clearly was able to detect and record its orientation and 2) that this information was stored within my photos. The only real surprise was that I'd never really paid much attention to this before.
OK, so what's going on and how much information is stored and where?
To begin, all the metadata regarding the photos that we take with our digital cameras and phones are stored in the EXIF (exchangeable image format) data that is incorporated into the jpg (and tiff) photos. This information is quite extensive -- depending on the digital camera you're using, containing detailed information about the photo such as the make and model of the digital camera that was used, whether a flash was used, the focal length, light value, and the shutter speed that was used when it was taken. And, if your phone/camera has geotagging turned on, it will also include the altitude, longitude and latitude of the place where the photo was taken.
In addition, when I update an image with Gimp, say to crop it or rotate it 90 degrees, Gimp also adds information to the image file.
Some of the type of information that is stored is shown in the data sample below. The data doesn't look like this within the image, of course, but has been extracted with a tool called exiftool that works on Linux, Mac OS X, and Windows and labels the fields as shown to make the data more usable.
ExifTool Version Number : 10.03 File Name : myself.jpg Directory : /home/shenry-stocker/images File Size : 52 kB File Modification Date/Time : 2015:10:30 19:34:15-04:00 File Access Date/Time : 2015:10:31 19:36:23-04:00 File Creation Date/Time : 2015:10:30 19:27:20-04:00 File Permissions : rw-rw-rw- File Type : JPEG File Type Extension : jpg MIME Type : image/jpeg JFIF Version : 1.01 Exif Byte Order : Big-endian (Motorola, MM) Make : Apple Camera Model Name : iPhone 4S
The data that had piqued my curiosity -- the orientation or "rotation" of the image -- was stored in a field that was displayed like this:
Orientation : Rotate 90
Geotagging causes the longitude and latitude to be captured. Displayed with exiftool, it will look like this, pinpointing the location with considerable precision:
GPS Altitude : 75 m Above Sea Level GPS Latitude : 38 deg 5' 54.79" N GPS Longitude : 76 deg 26' 13.27" W GPS Position : 38 deg 5' 54.79" N, 76 deg 26' 13.27" W
Sometimes, you might want to remove, change, or simply examine this data. For example, if you're a very serious photographer, you might not want to share all the details of how you made the shot. These might comprise your own kind of "photography trade secret". Or you might not want anyone to know where you were a photo was shot or the date and time that it was shot. Or you just might not want the extra data adding bulk to the size of your files. You might also sometimes want to add data -- for example, to insert a copyright notice into your image files. All of these things can easily be done with exiftool.
After installing exiftool, you would open a terminal or cmd window and type "exiftool" followed by the name of the image file. Alternately, you can type "exiftool" followed by a blank and then drag the image into the window and then press enter. The result would look like the samples displayed above, but you should expect see 80 lines or more of descriptive information.
To make changes to the data, you would use an exiftool command on the command line. Typing "exiftool" followed by "-h" displays a man page Here are some handy examples of how to use exiftool.
First, we've seen how to display all of the EXIF data by typing "exiftool" followed by the file name. To remove ALL (nearly all) EXIF data, you would use a command like this:
exiftool -all= myphoto.jpg
To remove the information from all of the EXIF data from all jpg files in the current directory, just use a wildcard:
exiftool -all= *.jpg
To remove just the location data:
exiftool -geotag= myself.jpg
$ exiftool me.jpg ExifTool Version Number : 10.03 File Name : myself.jpg Directory : . File Size : 45 kB File Modification Date/Time : 2015:11:01 08:05:35-05:00 File Access Date/Time : 2015:11:01 08:06:03-05:00 File Creation Date/Time : 2015:10:30 19:27:20-04:00 File Permissions : rw-rw-rw- File Type : JPEG File Type Extension : jpg MIME Type : image/jpeg Image Width : 200 Image Height : 267 Encoding Process : Baseline DCT, Huffman coding Bits Per Sample : 8 Color Components : 3 Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2) Image Size : 200x267 Megapixels : 0.053
Fortunately, uploading image files to facebook seems to remove the geotag data. I don't know if this is true of all sites to which you might post images, but it likely is for sites that consider privacy issues. If you want to share photos, I'd still suggest that you remove this information if you're at all concerned about it.
To remove geotagging data from a photo, us this command:
$ exiftool -geotag= myself.jpg
And, again, you can remove the data for all of your jpg files using a wildcard. The tool will tell you how many files it modified and how many were left unchanged (i.e., they didn't contain location data in the first place).
$ exiftool -geotag= *.jpg
The sizes of photos varies greatly with the format of the file and what you do with it. The listing below shows a sample image in its original jpg form, after I edited with GIMP, after I saved it as a png file, and when I saved is a tiff file, but without selecting the compression option.
10/03/2015 05:25 PM 3,158,857 flower1.jpg original 10/27/2015 07:13 PM 4,257,205 flower2.jpg after GIMP added data 10/27/2015 07:18 PM 9,476,956 flower3.png saved as png 10/27/2015 08:05 PM 23,971,468 flower4.tiff saved as tiff (no compression)
The change in size with the removal of EXIF data isn't nearly as dramatic, but here's an example of the before (original) and after. Notice how exiftool preserves a copy of the original file -- just in case you change your mind.
11/02/2015 09:57 AM 1,412,962 Liam-0615.JPG 06/06/2015 11:34 AM 1,428,682 Liam-0615.JPG_original
Even my four-year-old phone manages to store a lot of metadata into the photos that I take -- more than I had ever imagined was being captured when I tapped the little circle on the screen. Maybe when I drive across the country and back to enjoy some of the scenic spots in the US, the geotagging information will come in handy. At least I now know that it's available and how it's being stored.