Skip to content

Instantly share code, notes, and snippets.

@comstock
Last active November 26, 2025 14:35
Show Gist options
  • Select an option

  • Save comstock/f4ef66bdc7a77621bee616f3a16420e3 to your computer and use it in GitHub Desktop.

Select an option

Save comstock/f4ef66bdc7a77621bee616f3a16420e3 to your computer and use it in GitHub Desktop.
Use exiftool to generate table of image data in CSV format

Gather image metadata using Exiftool from a directory of images

Metadata is captured as a CSV file facilitating analysis of image-groupings.

Command line elements:

exiftool -recurse [image dir name] -csv -@ [file listing of sought metadata fields] [filename pattern] > [output filename]

Example:

exiftool -recurse ./this-directory -csv -@ out.args *.tif > exiftool_output.csv

Where the content of the out.args file is a listing of targeted EXIF tags, e.g.:

-FileName
-Directory
-FileSize
-FileSize#
-FileModifyDate
-FileAccessDate
-FileInodeChangeDate
-FileType
-FileTypeExtension
-MIMEType
-MajorBrand
-ImageHeight
-ImageWidth
-NumberOfComponents
-BitsPerComponent
-Compression
-ColorSpecMethod
-ProfileClass
-ColorSpace
-ColorSpaceData
-ProfileCreator
-ProfileID
-ProfileCopyright
-ProfileDescription
-CaptureYResolution
-CaptureXResolution
-CaptureYResolutionUnit
-CaptureXResolutionUnit
-Make
-Model
-Orientation
-XResolution
-YResolution
-ResolutionUnit
-ExposureTime
-ISO
-LightSource
-ImageNumber
-ImageHistory
-SensingMethod
-WhiteBalance
-ImageUniqueID
-SerialNumber
-ApplicationRecordVersion
-ColorMode
-ICCProfileName
-BitsPerSample
-PhotometricInterpretation
-PlanarConfiguration
-SamplesPerPixel
-GPSLatitude
-GPSLongitude
-GPSLatitudeRef
-GPSLongitudeRef
-GPSAltitudeRef
-GPSAltitude
-GPSImgDirectionRef
-GPSImgDirection
-GPSPosition

Gather image metadata (specifically defined set) from 1-bit, bitonal TIFF images

  1. Create a list of TIFFs

find . -type f | grep -E --ignore-case "(tif$|tiff$)" > tiff-list.txt

  1. Create a list of metadata fields to extract. For example:
clear ; echo "\
-FileName
-Compression
-NumberOfComponents
-BitsPerComponent
-BitsPErSample
-FileSize
-ProfileDescription
-MIMEType
-ImageHeight
-ImageWidth
-FileSize#" > args.txt
  1. Run exiftool command

exiftool -if '$bitspersample eq "1"' -csv -@ tiff-list.txt -@ args.txt > exiftoolBitonal.csv

@comstock
Copy link
Copy Markdown
Author

comstock commented Feb 9, 2024

Shortlist

-FileName
-Compression
-NumberOfComponents
-BitsPerComponent
-BitsPerSample
-FileSize
-ProfileDescription
-MIMEType
-ImageHeight
-ImageWidth
-FileSize#

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment