Typical digital images or photos have a rich set of metadata embedded in them. The metadata is automatically written by digital cameras, or manually added by photographers or photo editing software, to show various properties (e.g., creator, camera info, location) of a particular picture. Pdf documents also have its own set of metadata associated with them to identify author, title, date, etc.
There are various tools that allow you to edit the metadata in digital photos or pdf documents. ExifTool is a powerful command-line utility that can read or write meta information in a file. It is available on Linux, Windows or MacOS X.
In this tutorial, I will describe how to view or edit metadata in pdf documents or digital pictures from the command line on Linux with ExifTool.
Install ExifTool on Linux
ExifTool requires Perl 5.004 or later. No other library or software is required.
To install ExifTool on Debian, Ubuntu or Linux Mint:
To install ExifTool on Fedora:
To install ExifTool on CentOS or RHEL, first enable EPEL repository, and then run:
Metadata Supported by ExifTool
Below is a list of file types and metadata currently supported by ExifTool ("r" = read, "w" = write, "c" = create).
Supported file types:
------------+-------------+-------------+-------------+------------ 3FR r | DVB r | M4A/V r | PBM r/w | RWL r/w 3G2 r | DYLIB r | MEF r/w | PDF r/w | RWZ r 3GP r | EIP r | MIE r/w/c | PEF r/w | RM r ACR r | EPS r/w | MIFF r | PFA r | SO r AFM r | ERF r/w | MKA r | PFB r | SR2 r/w AI r/w | EXE r | MKS r | PFM r | SRF r AIFF r | EXIF r/w/c | MKV r | PGF r | SRW r/w APE r | F4A/V r | MNG r/w | PGM r/w | SVG r ARW r/w | FLA r | MOS r/w | PICT r | SWF r ASF r | FLAC r | MOV r | PMP r | THM r/w AVI r | FLV r | MP3 r | PNG r/w | TIFF r/w BMP r | FPX r | MP4 r | PPM r/w | TTC r BTF r | GIF r/w | MPC r | PPT r | TTF r COS r | GZ r | MPG r | PPTX r | VRD r/w/c CR2 r/w | HDP r/w | MPO r/w | PS r/w | VSD r CRW r/w | HTML r | MQV r | PSB r/w | WAV r CS1 r/w | ICC r/w/c | MRW r/w | PSD r/w | WDP r/w DCM r | IIQ r/w | MXF r | PSP r | WEBP r DCP r/w | IND r/w | NEF r/w | QTIF r | WEBM r DCR r | ITC r | NRW r/w | RA r | WMA r DFONT r | JNG r/w | NUMBERS r | RAF r/w | WMV r DIVX r | JP2 r/w | ODP r | RAM r | X3F r/w DJVU r | JPEG r/w | ODS r | RAR r | XCF r DLL r | K25 r | ODT r | RAW r/w | XLS r DNG r/w | KDC r | OGG r | RIFF r | XLSX r DOC r | KEY r | ORF r/w | RSRC r | XMP r/w/c DOCX r | LNK r | OTF r | RTF r | ZIP r DV r | M2TS r | PAGES r | RW2 r/w |
Supported metadata standards and types:
----------------------+----------------------+--------------------- EXIF r/w/c | CIFF r/w | Ricoh RMETA r GPS r/w/c | AFCP r/w | Picture Info r IPTC r/w/c | Kodak Meta r/w | Adobe APP14 r XMP r/w/c | FotoStation r/w | MPF r MakerNotes r/w/c | PhotoMechanic r/w | Stim r Photoshop IRB r/w/c | JPEG 2000 r | APE r ICC Profile r/w/c | DICOM r | Vorbis r MIE r/w/c | Flash r | SPIFF r JFIF r/w/c | FlashPix r | DjVu r Ducky APP12 r/w/c | QuickTime r | M2TS r PDF r/w/c | Matroska r | PE/COFF r PNG r/w/c | GeoTIFF r | AVCHD r Canon VRD r/w/c | PrintIM r | ZIP r Nikon Capture r/w/c | ID3 r | (and more)
To view all metadata in a picture:
ExifTool Version Number : 8.60 File Name : 1.jpg Directory : . File Size : 3.2 MB File Modification Date/Time : 2013:08:27 17:00:28-04:00 File Permissions : rw-rw-r-- File Type : JPEG MIME Type : image/jpeg Exif Byte Order : Little-endian (Intel, II) Make : SONY Camera Model Name : DSLR-A900 Orientation : Horizontal (normal) X Resolution : 240 Y Resolution : 240 Resolution Unit : inches Software : Adobe Photoshop CS5 Windows Modify Date : 2013-08-26T19:50:43+01:00 Artist : Dan N Copyright : Sean Barden Exposure Time : 1/200 F Number : 7.1 Exposure Program : Manual ISO : 100 . . .
To change the title and author information of a pdf document:
To modify tags of multiple images in a batch:
To modify artist name for all media files located in a target directory:
To show all metadata information in an image, including duplicate and
unknown tags, sorted by group (for family 1):
To show all metadata fields which contain the word "Date":
File Modification Date/Time : 2013:08:24 00:54:58-04:00 Modify Date : 2013:08:24 04:54:58
To extract GPS coordinate information from a photo:
GPS Latitude : 54 deg 9' 42.68" N GPS Longitude : 5 deg 58' 35.93" W
To show GPS coordinate information contained in a picture in a tabular format (e.g., <filename> <latitude> <longitude>):
input.jpg 54 deg 9' 42.68" N 5 deg 58' 35.93" W
Subscribe to Xmodulo
Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!
Latest posts by Dan Nanni (see all)
- How to install Suricata intrusion detection system on Linux - September 3, 2015
- How to switch from NetworkManager to systemd-networkd on Linux - August 31, 2015
- How to set up a system status page of your infrastructure - August 25, 2015