Skip to main content

Extract EXIF-Data from Images

· 6 min read
Strider

Pictures and more pictures. We all like photos and pictures, but what if the pictures also contain more than you see at first glance? It should be known to everyone, but I'll just write a post about it anyway.

Each file has its metadata, which contains further information about the file. This includes the date and time when the file was created or modified. Even the last access is stored in the metadata. With pictures there is still the Exifdaten, these can contain not only date and time and all other file information, but also with which software, the picture was created, or which camera was used. Where exactly the image was created. When exactly. Exposure encodings etc. This data is added automatically by many cameras as well as by some programs.

As an example image I take https://github.com/ianare/exif-samples/blob/master/jpg/gps/DSCN0010.jpg

DSCN0010.jpg

This image file is sufficient for the purposes. This image was uploaded to Github for such purposes.

Where is the data in an image file? A small rough schematic structure, clarifies how an image file is approximately structured.

dia.png

If we simply drag the image file into a text editor, it looks very confusing. However, we also see individual text fragments that reveal a bit more about the image.

editor.png

We can already see that the picture was taken with a Nikon camera, model Coolpix P6000. We also see a few timestamps. We can also assume the camera software Nikon Transfer 1.1W. Furthermore, we see here in red hex values, which in turn also provide further information about the image. We also see the magic word Exif.

There are countless ways to display the exif data. e.g. http://metapicz.com/#landing or exif, exiftool under Linux.

For simplification I have taken exif. We now see the following information contained in the image file.

exif.png

We see a lot of information, such as file name, file size, camera manufacturer, model, software, color space, etc.... This data gives us a lot of information about the image and the creator. Here we see that it was taken in 2008:10:22 16:28:39. This can tell us when he must have been there when the picture was taken.

An extended output, with the program exiftool, shows even more than the program exif.

ExifTool Version Number         : 10.40
File Name : DSCN0010.jpg
Directory : .
File Size : 158 kB
File Modification Date/Time : 2019:06:07 15:32:43+02:00
File Access Date/Time : 2019:06:07 15:32:49+02:00
File Inode Change Date/Time : 2019:06:07 15:32:43+02:00
File Permissions : rw-r--r--
File Type : JPEG
File Type Extension : jpg
MIME Type : image/jpeg
Exif Byte Order : Little-endian (Intel, II)
Image Description :
Make : NIKON
Camera Model Name : COOLPIX P6000
Orientation : Horizontal (normal)
X Resolution : 300
Y Resolution : 300
Resolution Unit : inches
Software : Nikon Transfer 1.1 W
Modify Date : 2008:11:01 21:15:07
Y Cb Cr Positioning : Centered
Exposure Time : 1/75
F Number : 5.9
Exposure Program : Program AE
ISO : 64
Exif Version : 0220
Date/Time Original : 2008:10:22 16:28:39
Create Date : 2008:10:22 16:28:39
Components Configuration : Y, Cb, Cr, -
Exposure Compensation : 0
Max Aperture Value : 2.7
Metering Mode : Multi-segment
Light Source : Unknown
Flash : Off, Did not fire
Focal Length : 24.0 mm
Maker Note Version : 2.10
Color Mode : Color
Quality : Fine
White Balance : Auto
Focus Mode : AF-S
Flash Setting :
ISO Selection : Auto
Data Dump : (Binary data 2542 bytes, use -b option to extract)
Face Detect Frame Size : 320 240
Faces Detected : 0
Active D-Lighting : Off
Image Adjustment : Normal
Tone Comp : Normal
Auxiliary Lens : Off
Digital Zoom : 1
AF Area Mode : Single Area
AF Point : Center
AF Points In Focus : (none)
Scene Mode :
Distortion Control : Off
Noise Reduction : Off
Scene Assist :
Retouch History : None
Image Stabilization : VR-On
Picture Control Version : 0100
Picture Control Name : Standard
Picture Control Base : Standard
Picture Control Adjust : Default Settings
Picture Control Quick Adjust : Normal
Brightness : n/a
Hue Adjustment : n/a
Filter Effect : n/a
Toning Effect : n/a
Toning Saturation : n/a
Nikon Capture Version : COOLPIX P6000V1.0
NEF Bit Depth : n/a (JPEG)
User Comment :
Flashpix Version : 0100
Color Space : sRGB
Exif Image Width : 640
Exif Image Height : 480
Interoperability Index : R98 - DCF basic file (sRGB)
Interoperability Version : 0100
File Source : Digital Camera
Scene Type : Directly photographed
Custom Rendered : Normal
Exposure Mode : Auto
Digital Zoom Ratio : 0
Focal Length In 35mm Format : 112 mm
Scene Capture Type : Standard
Gain Control : None
Contrast : Normal
Saturation : Normal
Sharpness : Normal
Subject Distance Range : Unknown
GPS Latitude Ref : North
GPS Longitude Ref : East
GPS Altitude Ref : Above Sea Level
GPS Time Stamp : 14:27:07.24
GPS Satellites : 06
GPS Img Direction Ref : Unknown ()
GPS Map Datum : WGS-84
GPS Date Stamp : 2008:10:23
Compression : JPEG (old-style)
Thumbnail Offset : 4560
Thumbnail Length : 6702
Image Width : 640
Image Height : 480
Encoding Process : Baseline DCT, Huffman coding
Bits Per Sample : 8
Color Components : 3
Y Cb Cr Sub Sampling : YCbCr4:2:2 (2 1)
XMP Toolkit : Public XMP Toolkit Core 3.5
Rating Percent : 0
Aperture : 5.9
GPS Date/Time : 2008:10:23 14:27:07.24Z
GPS Latitude : 43 deg 28' 2.81" N
GPS Longitude : 11 deg 53' 6.46" E
GPS Position : 43 deg 28' 2.81" N, 11 deg 53' 6.46" E
Image Size : 640x480
Megapixels : 0.307
Scale Factor To 35 mm Equivalent: 4.7
Shutter Speed : 1/75
Thumbnail Image : (Binary data 6702 bytes, use -b option to extract)
Circle Of Confusion : 0.006 mm
Field Of View : 18.3 deg
Focal Length : 24.0 mm (35 mm equivalent: 112.0 mm)
Hyperfocal Distance : 15.16 m
Light Value : 12.0

You can even see stored GPS data, also which encodings are used "Huffman". The byte order little-endian as well as focal length, orientation (horizontal or vertical), etc.

Let's enter the GPS data at Google Maps. We get a result.

maps.png

We can see that we have found the approximate location of the image when we call up the photos of the surroundings. Now we know when the creator must have been there and where.

hit.png

It comes out pretty well with the photo at the beginning.

Let's have a look at the camera

cam.png

We think the camera on Amazon for 90€ looks good after all.

Let's summarize briefly. What do we know from the Exif data?

  • File name
  • File size
  • MIMEType
  • Which byteorder
  • Which resolution
  • Which color space
  • Which camera
  • Which camera software
  • When the image was taken
  • When the image was modified
  • When the image was last accessed
  • Where the picture was taken

I wish with this little post, have fun trying it out. A little tip: If you upload pictures, remove the exif data as good as you can 😄.