By default, the utility prints a summary of the Exif information
$ exiv2 img_1771.jpg File name : img_1771.jpg File size : 32764 Bytes MIME type : image/jpeg Image size : 480 x 360 Thumbnail : image/jpeg, 5448 Bytes Camera make : Canon Camera model : Canon PowerShot S40 Image timestamp : 2003:12:14 12:01:44 File number : 117-1771 Exposure time : 1/500 s Aperture : F4.9 Exposure bias : 0 EV Flash : No, auto Flash bias : 0 EV Focal length : 21.3 mm Subject distance: 7.82 m ISO speed : 100 Exposure mode : Program (P) Metering mode : Center weighted average Macro mode : Off Image quality : Superfine White balance : Auto Copyright : Exif comment :
Image with the Exif data shown in the sample output
With the -pt option, the utility prints out all Exif information as interpreted (translated) values. Alternatively, -pv prints the plain Exif data values.
$ exiv2 -pt img_1771.jpg Exif.Image.Make Ascii 6 Canon Exif.Image.Model Ascii 20 Canon PowerShot S40 Exif.Image.Orientation Short 1 top, left Exif.Image.XResolution Rational 1 180 Exif.Image.YResolution Rational 1 180 Exif.Image.ResolutionUnit Short 1 inch Exif.Image.DateTime Ascii 20 2003:12:14 12:01:44 Exif.Image.YCbCrPositioning Short 1 Centered Exif.Image.ExifTag Long 1 196 Exif.Photo.ExposureTime Rational 1 1/500 s Exif.Photo.FNumber Rational 1 F4.9 Exif.Photo.ExifVersion Undefined 4 2.20 Exif.Photo.DateTimeOriginal Ascii 20 2003:12:14 12:01:44 Exif.Photo.DateTimeDigitized Ascii 20 2003:12:14 12:01:44 Exif.Photo.ComponentsConfiguration Undefined 4 YCbCr Exif.Photo.CompressedBitsPerPixel Rational 1 5 Exif.Photo.ShutterSpeedValue SRational 1 1/501 s Exif.Photo.ApertureValue Rational 1 F5 Exif.Photo.ExposureBiasValue SRational 1 0 EV Exif.Photo.MaxApertureValue Rational 1 F2.8 Exif.Photo.MeteringMode Short 1 Center weighted average Exif.Photo.Flash Short 1 No, auto Exif.Photo.FocalLength Rational 1 21.3 mm Exif.Photo.MakerNote Undefined 450 12 0 1 0 3 0 40 0 0 0 68 4 0 0 2 0 3 0 4 0 0 0 148 4 0 0 3 0 3 0 4 0 0 0 156 4 0 0 4 0 3 0 27 0 0 0 164 4 0 0 0 0 3 0 6 0 0 0 218 4 0 0 0 0 3 0 4 0 0 0 230 4 0 0 6 0 2 0 32 0 0 0 238 4 0 0 7 0 2 0 24 0 0 0 14 5 0 0 8 0 4 0 1 0 0 0 59 225 17 0 9 0 2 0 32 0 0 0 38 5 0 0 16 0 4 0 1 0 0 0 0 0 17 1 13 0 3 0 21 0 0 0 70 5 0 0 0 0 0 0 80 0 2 0 0 0 5 0 1 0 0 0 0 0 4 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 17 0 5 0 1 0 3 48 1 0 255 255 255 255 170 2 227 0 32 0 149 0 192 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 49 0 224 8 224 8 0 0 1 0 2 0 170 2 30 1 215 0 0 0 0 0 0 0 0 0 54 0 0 0 160 0 20 1 149 0 31 1 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 2 48 0 0 0 0 0 0 1 0 14 3 0 0 149 0 33 1 0 0 0 0 0 0 250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 73 77 71 58 80 111 119 101 114 83 104 111 116 32 83 52 48 32 74 80 69 71 0 0 0 0 0 0 0 0 0 0 70 105 114 109 119 97 114 101 32 86 101 114 115 105 111 110 32 49 46 49 48 0 0 0 65 110 100 114 101 97 115 32 72 117 103 103 101 108 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 42 0 3 0 1 128 122 1 1 128 0 0 0 0 0 0 3 1 2 0 0 0 10 0 0 0 0 0 0 0 57 0 198 0 5 0 0 0 0 0 0 0 Exif.MakerNote.Offset Long 1 942 Exif.MakerNote.ByteOrder Ascii 3 II Exif.CanonCs.Macro Short 1 Off Exif.CanonCs.Selftimer Short 1 Off Exif.CanonCs.Quality Short 1 Superfine Exif.CanonCs.FlashMode Short 1 Auto Exif.CanonCs.DriveMode Short 1 Single / timer Exif.CanonCs.FocusMode Short 1 Single Exif.CanonCs.RecordMode Short 1 JPEG Exif.CanonCs.ImageSize Short 1 Large Exif.CanonCs.EasyMode Short 1 Manual Exif.CanonCs.DigitalZoom Short 1 None Exif.CanonCs.Contrast Short 1 Normal Exif.CanonCs.Saturation Short 1 Normal Exif.CanonCs.Sharpness Short 1 Normal Exif.CanonCs.ISOSpeed Short 1 100 Exif.CanonCs.MeteringMode Short 1 Center-weighted average Exif.CanonCs.FocusType Short 1 Auto Exif.CanonCs.AFPoint Short 1 Center Exif.CanonCs.ExposureProgram Short 1 Program (P) Exif.CanonCs.LensType Short 1 n/a Exif.CanonCs.Lens Short 3 7.1 - 21.3 mm Exif.CanonCs.MaxAperture Short 1 F5 Exif.CanonCs.MinAperture Short 1 F8 Exif.CanonCs.FlashActivity Short 1 Did not fire Exif.CanonCs.FlashDetails Short 1 Exif.CanonCs.FocusContinuous Short 1 Single Exif.CanonCs.AESetting Short 1 Normal AE Exif.CanonCs.ImageStabilization Short 1 (65535) Exif.CanonCs.DisplayAperture Short 1 49 Exif.CanonCs.ZoomSourceWidth Short 1 2272 Exif.CanonCs.ZoomTargetWidth Short 1 2272 Exif.CanonCs.SpotMeteringMode Short 1 AF Point Exif.Canon.FocalLength Short 4 21.3 mm Exif.Canon.CanonFlashInfo Short 4 0 0 0 0 Exif.CanonSi.AutoISO Short 1 100 Exif.CanonSi.ISOSpeed Short 1 100 Exif.CanonSi.MeasuredEV Short 1 13.63 Exif.CanonSi.TargetAperture Short 1 F5 Exif.CanonSi.TargetShutterSpeed Short 1 1/501 s Exif.CanonSi.ExposureCompensation Short 1 0 Exif.CanonSi.WhiteBalance Short 1 Auto Exif.CanonSi.SlowShutter Short 1 Off Exif.CanonSi.Sequence Short 1 0 Exif.CanonSi.OpticalZoomCode Short 1 6 Exif.CanonSi.CameraTemperature Short 1 -- Exif.CanonSi.FlashGuideNumber Short 1 0 Exif.CanonSi.AFPointUsed Short 1 3 focus points; center used Exif.CanonSi.FlashBias Short 1 0 EV Exif.CanonSi.AutoExposureBracketing Short 1 Off Exif.CanonSi.AEBBracketValue Short 1 0 Exif.CanonSi.ControlMode Short 1 1 Exif.CanonSi.SubjectDistance Short 1 7.82 m Exif.CanonSi.ApertureValue Short 1 F5 Exif.CanonSi.ShutterSpeedValue Short 1 1/523 s Exif.CanonSi.MeasuredEV2 Short 1 -6.00 Exif.CanonSi.BulbDuration Short 1 0 Exif.CanonSi.CameraType Short 1 Compact Exif.Canon.ImageType Ascii 32 IMG:PowerShot S40 JPEG Exif.Canon.FirmwareVersion Ascii 24 Firmware Version 1.10 Exif.Canon.FileNumber Long 1 117-1771 Exif.Canon.OwnerName Ascii 32 Andreas Huggel Exif.Canon.ModelID Long 1 PowerShot S40 Exif.Canon.CameraInfo Short 21 42 3 32769 378 32769 0 0 0 259 2 0 10 0 0 0 57 198 5 0 0 0 Exif.Photo.UserComment Undefined 264 Exif.Photo.FlashpixVersion Undefined 4 1.00 Exif.Photo.ColorSpace Short 1 sRGB Exif.Photo.PixelXDimension Short 1 2272 Exif.Photo.PixelYDimension Short 1 1704 Exif.Photo.InteroperabilityTag Long 1 1416 Exif.Iop.InteroperabilityIndex Ascii 4 R98 Exif.Iop.InteroperabilityVersion Undefined 4 1.00 Exif.Iop.RelatedImageWidth Short 1 2272 Exif.Iop.RelatedImageLength Short 1 1704 Exif.Photo.FocalPlaneXResolution Rational 1 8114.29 Exif.Photo.FocalPlaneYResolution Rational 1 8114.29 Exif.Photo.FocalPlaneResolutionUnit Short 1 inch Exif.Photo.SensingMethod Short 1 One-chip color area Exif.Photo.FileSource Undefined 1 Digital still camera Exif.Photo.CustomRendered Short 1 Normal process Exif.Photo.ExposureMode Short 1 Auto Exif.Photo.WhiteBalance Short 1 Auto Exif.Photo.DigitalZoomRatio Rational 1 1.0 Exif.Photo.SceneCaptureType Short 1 Standard Exif.Thumbnail.Compression Short 1 JPEG (old-style) Exif.Thumbnail.XResolution Rational 1 180 Exif.Thumbnail.YResolution Rational 1 180 Exif.Thumbnail.ResolutionUnit Short 1 inch Exif.Thumbnail.JPEGInterchangeFormat Long 1 2036 Exif.Thumbnail.JPEGInterchangeFormatLength Long 1 5448
Short description of the actions and options supported by the Exiv2 utility (see the man page for details)
$ exiv2 -h Usage: exiv2 [ option [ arg ] ]+ [ action ] file ... Image metadata manipulation tool. Where file is one or more files, optionally containing a URL (http, https, ftp, sftp, data or file) or wildcard Actions: pr | print Print image metadata (default is a summary). This is the default action ad | adjust Adjust Exif timestamps by the given time. Requires at least one of -a, -Y, -O or -D rm | delete Deletes image metadata, use -d to choose type to delete (default is all) in | insert Insert metadata from .exv, .xmp, thumbnail or .icc file. Use option -S to change the suffix of the input files and -l to change the location ex | extract Extract metadata to .exv, .xmp, preview image, thumbnail, or ICC profile. Use option -S to change the suffix of the input files and -l to change the location mv | rename Rename files and/or set file timestamps according to the Exif timestamps. The filename format can be set with -r format, timestamp options are controlled with -t and -T mo | modify Apply commands to modify the Exif, IPTC and XMP metadata. Requires option -m or -M fi | fixiso Copy ISO setting from Canon and Nikon makernotes, to the standard Exif tag fc | fixcom Convert the Unicode Exif user comment to UCS-2. The current character encoding can be specified with the -n option Options: -h Display this help and exit -V Show the program version and exit -v Be verbose during the program run -q Silence warnings and error messages (quiet) -Q lvl Set log-level to d(ebug), i(nfo), w(arning), e(rror) or m(ute) -b Obsolete, reserved for use with the test suit -u Show unknown tags (e.g., Exif.SonyMisc3c.0x022b) -g str Only output where 'str' matches in output text (grep) Append /i to 'str' for case insensitive -K key Only output where 'key' exactly matches tag's key -n enc Character set to decode Exif Unicode user comments -k Preserve file timestamps when updating files (keep) -t Set the file timestamp from Exif metadata when renaming (overrides -k) -T Only set the file timestamp from Exif metadata ('rename' action) -f Do not prompt before overwriting existing files (force) -F Do not prompt before renaming files (Force) -a time Time adjustment in the format [+|-]HH[:MM[:SS]]. For 'adjust' action -Y yrs Year adjustment with the 'adjust' action -O mon Month adjustment with the 'adjust' action -D day Day adjustment with the 'adjust' action -p mode Print mode for the 'print' action. Possible modes are: s : A summary of the Exif metadata (the default) a : Exif, IPTC and XMP tags (shortcut for -Pkyct) e : Exif tags (shortcut for -PEkycv) t : Interpreted (translated) Exif tags (-PEkyct) v : Plain (untranslated) Exif tags values (-PExgnycv) h : Hex dump of the Exif tags (-PExgnycsh) i : IPTC tags (-PIkyct) x : XMP tags (-PXkyct) c : JPEG comment p : List available image preview, sorted by size C : Print ICC profile R : Recursive print structure of image (debug build only) S : Print structure of image (limited file types) X : Extract "raw" XMP -P flgs Print flags for fine control of tag lists ('print' action): E : Exif tags I : IPTC tags X : XMP tags x : Tag number for Exif or IPTC tags (in hexadecimal) g : Group name (e.g. Exif.Photo.UserComment, Photo) k : Key (e.g. Exif.Photo.UserComment) l : Tag label (e.g. Exif.Photo.UserComment, 'User comment') d : Tag description n : Tag name (e.g. Exif.Photo.UserComment, UserComment) y : Type y : Type c : Number of components (count) s : Size in bytes of vanilla value (may include NULL) v : Plain data value of untranslated (vanilla) V : Plain data value, data type and the word 'set' t : Interpreted (translated) human readable values h : Hex dump of the data -d tgt1 Delete target(s) for the 'delete' action. Possible targets are: a : All supported metadata (the default) e : Exif tags t : Exif thumbnail only i : IPTC tags x : XMP tags c : JPEG comment C : ICC Profile c : All IPTC data (any broken multiple IPTC blocks) - : Input from stdin -i tgt2 Insert target(s) for the 'insert' action. Possible targets are a : All supported metadata (the default) e : Exif tags t : Exif thumbnail only (JPEGs only from <file>-thumb.jpg) i : IPTC tags x : XMP tags c : JPEG comment C : ICC Profile, from <file>.icc X : XMP sidecar from file <file>.xmp XX: "raw" metadata from <file>.exv. XMP default, optional Exif and IPTC - : Input from stdin -e tgt3 Extract target(s) for the 'extract' action. Possible targets a : All supported metadata (the default) e : Exif tags t : Exif thumbnail only (to <file>-thumb.jpg) i : IPTC tags x : XMP tags c : JPEG comment pN: Extract N'th preview image to <file>-preview<N>.<ext> C : ICC Profile, to <file>.icc X : XMP sidecar to <file>.xmp XX: "raw" metadata to <file>.exv. XMP default, optional Exif and IPTC - : Output to stdin -r fmt Filename format for the 'rename' action. The format string follows strftime(3). The following keywords are also supported: :basename: - original filename without extension :basesuffix: - suffix in original filename, starts with first dot and ends before extension :dirname: - name of the directory holding the original file :parentname: - name of parent directory Default 'fmt' is %Y%m%d_%H%M%S -c txt JPEG comment string to set in the image. -m cmdf Applies commands in 'cmdf' file, for the modify action (see -M for format). -M cmd Command line for the modify action. The format is: ( (set | add) <key> [[<type>] <value>] | del <key> [<type>] | reg prefix namespace ) -l dir Location (directory) for files to be inserted from or extracted to. -S suf Use suffix 'suf' for source files for insert action. Examples: exiv2 -pe image.dng *.jp2 Print all Exif tags in image.dng and all .jp2 files exiv2 -g date/i https://clanmills.com/Stonehenge.jpg Print all tags in file, where key contains 'date' (case insensitive) exiv2 -M"set Xmp.dc.subject XmpBag Sky" image.tiff Set (or add if missing) value to tag in file
You can modify any Exif or IPTC metadata using modify-commands from a file (-m option) or directly from the command line (-M option). Multiple -M and -m directives can be combined. Here is a sample command file for the modify option (lines starting with # are comments)
# Sample Exiv2 command file # ------------------------- # # $ exiv2 -m cmd.txt file ... # # to apply the commands in cmd.txt to each file. Alternatively, commands can be # run from the command line directly, without a command file: # # $ exiv2 -M"add Iptc.Application2.Credit String mee too!" file ... # # Note the quotes. Multiple -m and -M options are allowed and can be combined. # # Command file format # ------------------- # Empty lines and lines starting with # are ignored # Each remaining line is a command. The format for command lines is # <cmd> <key> [[<type>] <value>] # cmd = set|add|del # set will set the value of an existing tag of the given key or add a tag # add will add a tag (unless the key is a non-repeatable IPTC key) # del will delete a tag # key = Exiv2 Exif or IPTC key # type = # Byte|Ascii|Short|Long|Rational|Undefined|SShort|SLong|SRational|Comment # for Exif keys, and # String|Date|Time|Short|Undefined for IPTC keys # The format for IPTC Date values is YYYY-MM-DD (year, month, day) and # for IPTC Time values it is HH:MM:SS±HH:MM where HH:MM:SS refers to local # hour, minute and seconds and ±HH:MM refers to hours and minutes ahead or # behind Universal Coordinated Time. # A default type is used if none is explicitly given. The default type # is determined based on the key. # value # The remaining text on the line is the value. It can optionally be enclosed in # double quotes ("value") # add Iptc.Application2.Credit String "mee too! (1)" add Iptc.Application2.Credit mee too! (2) del Iptc.Application2.Headline set Iptc.Application2.Headline Filename add Exif.Image.WhitePoint Short 32 12 4 5 6 set Exif.Image.DateTime Ascii "Zwanzig nach fuenf" set Exif.Image.Artist Ascii nobody set Exif.Image.Artist "Vincent van Gogh" set Exif.Photo.UserComment Comment charset=Ascii This is an ASCII Exif comment
The following commands are for XMP tags, the result is the same as that of Example 5.
# Sample Exiv2 command file for XMP tags # -------------------------------------- # Set basic properties. Exiv2 uses the value type of the XMP specification # for the property, if it is not specified. The default XMP value type # for unknown properties is a simple text value. # A simple text property. set Xmp.dc.source xmpsample.cpp # An array item (unordered array). set Xmp.dc.subject "Palmtree" # Add a 2nd array item set Xmp.dc.subject "Rubbertree" # A language alternative (without a default) set Xmp.dc.title lang=en-US Sunset on the beach set Xmp.dc.title lang=de-DE Sonnenuntergang am Strand # Any properties can be set provided the namespace is known. set Xmp.dc.one -1 set Xmp.dc.two 3.1415 set Xmp.dc.three 5/7 set Xmp.dc.four 255 set Xmp.dc.five 256 set Xmp.dc.six false set Xmp.dc.seven Seven # The value type can be specified. Exiv2 has support for a limited number # of specific XMP types with built-in types: The basic XmpText, array # types XmpAlt (alternative array), XmpBag (unordered array), XmpSeq # (ordered array) and language alternatives LangAlt. # Simple text property with explicitly specified value type set Xmp.dc.format XmpText "image/jpeg" # An ordered array set Xmp.dc.creator XmpSeq "1) The first creator" set Xmp.dc.creator "2) The second creator" set Xmp.dc.creator "3) And another one" # A language alternative. The default entry of a langauge alternative # doesn't need a language qualifier. set Xmp.dc.description LangAlt lang=de-DE Hallo, Welt set Xmp.dc.description LangAlt Hello, World # According to the XMP specification, Xmp.tiff.ImageDescription is an # alias for Xmp.dc.description. Exiv2 treats an alias just like any # other property. set Xmp.tiff.ImageDescription TIFF image description set Xmp.tiff.ImageDescription lang=de-DE TIFF Bildbeschreibung # Register a namespace which Exiv2 doesn't know yet with a prefix. reg ns myNamespace/ # There are no built-in Exiv2 value types for structures, qualifiers and # nested types. However, these can be added by using an XmpText value and a # path as the key. # Add a structure set Xmp.xmpDM.videoFrameSize/stDim:w 16 set Xmp.xmpDM.videoFrameSize/stDim:h 9 set Xmp.xmpDM.videoFrameSize/stDim:unit inch # Add an element with a qualifier (using the namespace registered earlier) set Xmp.dc.publisher James Bond set Xmp.dc.publisher/?ns:role secret agent # Add a qualifier to an array element of Xmp.dc.creator (added above) set Xmp.dc.creator[2]/?ns:role programmer # Add an array of structures. First set a text property with just the # array type. (Note: this is not the same as creating an XmpBag property.) set Xmp.xmpBJ.JobRef XmpText type=Bag # Then set the array items. Each of them is a structure with two elements. set Xmp.xmpBJ.JobRef[1]/stJob:name XmpText Birthday party set Xmp.xmpBJ.JobRef[1]/stJob:role XmpText Photographer set Xmp.xmpBJ.JobRef[2]/stJob:name Wedding ceremony set Xmp.xmpBJ.JobRef[2]/stJob:role Best man