The following guidelines relate to a few command line options of the exiftool utility. These tips are narrow in scope as they deal with specific issues for our digital content based on local practices and usage. Exiftool can be used for a much wider set of circumstances and file types. For in depth documentation see http://www.sno.phy.queensu.ca/~phil/exiftool/. For the online tool please see, Exif Viewer http://regex.info/exif.cgi.
Also see: Using exiftool for the QC process
Use case scenarios
-
File analysis: extracting technical information about the files (type, resolution, size, page count, etc.)
-
Quality control: to confirm digitization specifics have been met
-
Data is easily exportable to CSV format and can then be further manipulated for metadata and or analysis.
General commands
Switches
|
Description
|
-common
|
List most common technical info available for file
|
-H
|
List ALL data available for file
|
-r |
Recursively process subdirectories |
-T
|
Outputs data in tabular form (no labels)
|
>output.txt
|
Outputs data to text file
|
-csv |
Outputs ALL data with labels per column |
>out.csv |
Outputs data to csv file |
Example: exiftool –common filename.tif
This command is entered at the command line window.
- To get there on a pc, open the window that is one level up from the folder you want to analyze (it contains that folder), use shift and right-click to open a list of choices and choose "open command window here".
Tips
-
Since exifdata can vary greatly depending on file type and camera source, recommend testing a file or small representative sampling of files using the –H command to see all information available . Then make a selection of what information you may wish to extract.
-
Batch process: Copy any of the below example commands (shown in red) to a .bat file and then double click the .bat file from windows screen. This will output the results to a txt file. (which removes the need to manually type out the commands in a command prompt window. )
-
To create a .bat file:
-
Open Notepad
-
copy/past command from below examples or enter your own
-
Select: Save as type: All Files (*.*)
-
Change extension to *.bat
-
Press save
Examples
Display common characteristics for single file
Display common characteristics for multiple files
exiftool –common *.*
PDF page counts
Single file data:
To extract page counts for multiple PDFs:
Or send to text file:
exiftool –Filename –T –PageCount *.pdf >output-pagecount.txt
Image file types: Output multiple characteristics for a batch of files
Option 1: Provides ALL tags for files within subfolders.
May be used to help identify what tags exist with batch of newly received files as this option will list everything.
(a) Open command window at parent directory
(b) run command : exiftool -csv -r group >output.csv (where "group" is the name of the top level folder containing subfolders)
(c) When finished, on screen will display # of directories reviewed and # of files read
Figure: Example output using -csv tag (extensive data)
Option 2: This example contains switches specific to local practices.
exiftool -T -FileName -ImageDescription -Source -Rights -ICCProfileName -MIMEType -ImageSize -XResolution -Compression -BitsPerSample -Make -Model *.tif >exifdata-output.txt
tip: output data does not contain headers for columns. Will need to add separately
Figure: output text file opened in excel
Option 3: Other options with -csv
Extract data from external drive
C:\Users\mpr1>exiftool -csv -r F:\ >c:\Users\mpr1\Desktop\output.csv
where
-r means recursively process subdirectories
F:\ is the external drive (you can also enter the name of single top level folder instead)
the output csv file will be saved to the desktop (instead of the external drive directory).
When the operation is complete, a summary is shown on screen :
Output just common characteristics
exiftool -common -csv -r folder> out.csv
- helpful first pass when have lots of different kinds of files to reduce number of columns
Copying metadata from one file to another
Use -tagsFromFile SRCFILE
exiftool -TagsFromFile src.crw dst.jpg
Copy the values of all writable tags from "src.crw" to "dst.jpg", writing the information to the preferred groups.
exclude a tag from being copied ("--TAG"), Excluding a tag will prevent it from being copied to the destination image
see additional info:
Embed metadata to images and PDF files
Note: Can only use for images and PDF format types. Best used when have different titles, descriptions, etc. per file
Basic command:
exiftool -Title="This is the Title" -Author="Happy Man" -Subject="PDF Metadata" drawing.pdf
The program will create a backup of the original file if you do not use the; -overwrite_original switch, this means a duplicate will exist in the folder where the updated pdf is. From example above; a file named ; drawing.pdf_original will be created.
Prepare commands using excel. Then save to *.bat file to process across multiple files. See template Embed-metadata-template.xlsx
To create a *.bat file
- Open a text file, such as a Notepad
- Add your commands (i.e. copy and paste from excel template)
- Save your file with the file extension .bat, for example, test.bat. Note! Change file type to "all" instead of "text"
- To run your batch file, double click the BAT file you just created or open command open and run from prompt (this will provide any responses if there are errors).
References
Installing ExifTool | http://www.sno.phy.queensu.ca/~phil/exiftool/install.html
exiftool Application Documentation (look up tags options) | http://www.sno.phy.queensu.ca/~phil/exiftool/exiftool_pod.html
The Car Library Project: ExifTool - Reading and Writing Embedded Metadata. http://carlibrary.org/ExifTool.htm
(provides helpful examples and links to video tutorials)
Hack Your Exif Data from the Command Line: Five Fun Uses for Exiftool. Scott, Preston. (2012) https://petapixel.com/2012/05/25/hack-your-exif-data-from-the-command-line-five-fun-uses-for-exiftool/
How to edit pdf metadata from command line? https://askubuntu.com/questions/27381/how-to-edit-pdf-metadata-from-command-line
Batch metadata assignment to archival photograph collections using facial recognition software. Issue 21, 2013-07-15. http://journal.code4lib.org/articles/8486
Comments (0)
You don't have permission to comment on this page.