aboutsummaryrefslogtreecommitdiff

exiftool-badge.svg exiftool.el.svg

exiftool.el is an elisp wrapper around ExifTool. ExifTool supports reading and writing metadata in various formats including EXIF, XMP and IPTC.

There is a significant overhead in loading ExifTool for every command to be exected. So, exiftool.el starts an ExifTool process in the -stayopen mode, and passes all commands to it.

Installation

emacs:exiftool.svg

exiftool.el is available from MELPA. Or, you can also clone this git repo and add the path to your load-path.

Functions

High level functions

(exiftool-read FILE TAG…)

Read TAGS from FILE, return an alist mapping TAGS to values.

If a tag is not found, return an empty string "" as the value. If no TAGS are specified, read all tags from FILE.

(exiftool-read "test1.png" "ImageSize")
;; => '(("ImageSize" . "64x64"))
(exiftool-read "test1.png" "ImageSize" "Interlace")
;; => '(("ImageSize" . "64x64") ("Interlace" . "Noninterlaced"))
(exiftool-read "test1.png")
;; => '(("ExifToolVersion" . "10.20")
;; ("FileName" . "test1.png")
;; ("Directory" . ".")
;; ("FileSize" . "1234 bytes")
;; ("FileModifyDate" . "2017:02:19 00:31:36+05:30")
;; ("FileAccessDate" . "2017:02:22 00:21:53+05:30")
;; ("FileInodeChangeDate" . "2017:02:20 00:02:58+05:30")
;; ("FilePermissions" . "rw-r--r--")
;; ("FileType" . "PNG")
;; ("FileTypeExtension" . "png")
;; ("MIMEType" . "image/png")
;; ("ImageWidth" . "64") ...)

(exiftool-write FILE (TAG . VALUE)…)

Write tags to FILE.

The metadata to be written is specified as (TAG . VALUE) pairs. Specifying the empty string "" for VALUE deletes that TAG.

;; Set Marked to "True"
(exiftool-write "test1.png" '("Marked" . "True"))
;; Set Marked to "True", and Creator to "Foo"
(exiftool-write "test1.png"
                   '("Marked" . "True")
                   '("Creator" . "Foo"))

(exiftool-copy SOURCE DESTINATION &rest TAGS)

Copy TAGS from SOURCE file to DESTINATION file.

If no TAGS are specified, copy all tags from SOURCE.

;; Copy all writable tags
(exiftool-copy "source.png" "destination.png")
;; Copy only the tag "Marked"
(exiftool-copy "source.png" "destination.png" "Marked")
;; Copy only the tags "Marked" and "Creator"
(exiftool-copy "source.png" "destination.png" "Marked" "Creator")

Low level functions

(exiftool-command &rest ARGS)

Execute a command in the currently running exiftool process.

ARGS are arguments of the command to be run, as provided to the exiftool command line application.

(exiftool-run)

Start an exiftool process if one is not already running.

If an exiftool process is already running, delete it, and create a new one. Return the process object of the newly created process.

Running tests

Tests are located in the tests folder. You can run them using

make check

Contributing

Feedback, suggestions, feature requests, bug reports and patches are all welcome. Please contact me by mail at arunisaac@systemreboot.net.

License

exiftool.el is free software released under the terms of the GNU General Public License, either version 3 of the License, or (at your option) any later version.