title: Getting exif data from all images in a directory using Python
body: <p>I'm pretty new to Python and I am trying to write a script which will extract the exif data from all the images in a directory (and then do further "stuff" with the dictionary it creates).  I'm using Python 2.7 as it needs to work with ArcPy.</p>
  
  <p>I am trying to avoid having to install things using pip as it will be being used by users who can't do such things (network security) and I have found exifread does what I want with just one file, I just need for it to do it with more.</p>
  
  <p>So far the script I have is as follows:</p>
  
  <pre><code>import os
  import exifread
  
  # Select the directory which the image files are in
  
  dircont = raw_input("Please select the directory which you wish to retrieve geotags from ")
  
  # Get the list of image files
  directory = os.listdir(dircont)
  for files in directory:
  if files.endswith ('.jpg'):
      file_path = os.path.join(dircont, files)
      print file_path
  if files.endswith ('.JPG'):
      file_path = os.path.join(dircont, files)
      print file_path
  if files.endswith ('.png'):
      file_path = os.path.join(dircont, files)
      print file_path
  if files.endswith ('.PNG'):
      file_path = os.path.join(dircont, files)
      print file_path
  if files.endswith ('.tiff'):
      file_path = os.path.join(dircont, files)
      print file_path
  if files.endswith ('.TIFF'):
      file_path = os.path.join(dircont, files)
      print file_path  
  
  
  # EXIFREAD CODE
  # Open image file for reading (binary mode)
  
  f = open(file_path, 'rb')
  
  # Return Exif tags
  tags = exifread.process_file(f)
  
  for tag in tags.keys():
      if tag not in ('JPEGThumbnail', 'TIFFThumbnail', 'Filename', 'EXIF MakerNote'):
          print "Key: %s, value %s" % (tag, tags[tag])
  </code></pre>