How to view or edit pdf/image metadata from command line on Linux

本文介绍如何利用ExifTool从命令行查看和编辑PDF文档及数字图片中的元数据,包括安装ExifTool的方法及其支持的各种文件类型和元数据标准。
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:

$ sudo apt-get install libimage-exiftool-perl

To install ExifTool on Fedora:

$ sudo yum install perl-Image-ExifTool

To install ExifTool on CentOS or RHEL, first enable EPEL repository, and then run:

$ sudo yum install perl-Image-ExifTool

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)

Exiftool Examples

To view all metadata in a picture:

$ exiftool input.jpg
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:

$ exiftool -Title="This is the title" -Author="Dan Nanni" input.pdf

To modify tags of multiple images in a batch:

$ exiftool -artist="Dan Nanni" -copyright="2013 Dan Nanni" a.jpg b.jpg c.jpg

To modify artist name for all media files located in a target directory:

$ exiftool -artist="Dan Nanni" ./folder

To show all metadata information in an image, including duplicate and
unknown tags, sorted by group (for family 1):

$ exiftool -a -u -g2 input.jpg

To show all metadata fields which contain the word "Date":

$ exiftool -"*Date*" input.png
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:

$ exiftool -gpslatitude -gpslongitude input.jpg
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>):

$ exiftool -filename -gpslatitude -gpslongitude -T input.jpg
input.jpg    54 deg 9' 42.68" N    5 deg 58' 35.93" W

标题基于Python的自主学习系统后端设计与实现AI更换标题第1章引言介绍自主学习系统的研究背景、意义、现状以及本文的研究方法和创新点。1.1研究背景与意义阐述自主学习系统在教育技术领域的重要性和应用价值。1.2国内外研究现状分析国内外在自主学习系统后端技术方面的研究进展。1.3研究方法与创新点概述本文采用Python技术栈的设计方法和系统创新点。第2章相关理论与技术总结自主学习系统后端开发的相关理论和技术基础。2.1自主学习系统理论阐述自主学习系统的定义、特征和理论基础。2.2Python后端技术栈介绍DjangoFlask等Python后端框架及其适用场景。2.3数据库技术讨论关系型和非关系型数据库在系统中的应用方案。第3章系统设计与实现详细介绍自主学习系统后端的设计方案和实现过程。3.1系统架构设计提出基于微服务的系统架构设计方案。3.2核心模块设计详细说明用户管理、学习资源管理、进度跟踪等核心模块设计。3.3关键技术实现阐述个性化推荐算法、学习行为分析等关键技术的实现。第4章系统测试与评估对系统进行功能测试和性能评估。4.1测试环境与方法介绍测试环境配置和采用的测试方法。4.2功能测试结果展示各功能模块的测试结果和问题修复情况。4.3性能评估分析分析系统在高并发等场景下的性能表现。第5章结论与展望总结研究成果并提出未来改进方向。5.1研究结论概括系统设计的主要成果和技术创新。5.2未来展望指出系统局限性并提出后续优化方向。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值