#+TITLE: exiftool.el #+LINK: wikipedia https://en.wikipedia.org/wiki/ [[https://melpa.org/#/exiftool][https://melpa.org/packages/exiftool-badge.svg]] [[https://ci.systemreboot.net/jobs/exiftool.el][https://ci.systemreboot.net/badge/exiftool.el.svg]] exiftool.el is an elisp wrapper around [[http://www.sno.phy.queensu.ca/~phil/exiftool/][ExifTool]]. ExifTool supports reading and writing metadata in various formats including [[wikipedia:Exif][EXIF]], [[wikipedia:Extensible_Metadata_Platform][XMP]] and [[wikipedia:IPTC_Information_Interchange_Model][IPTC]]. There is a significant overhead in loading ExifTool for every command to be exected. So, exiftool.el starts an ExifTool process in the [[http://www.sno.phy.queensu.ca/~phil/exiftool/#performance][-stay_open mode]], and passes all commands to it. * Installation https://repology.org/badge/vertical-allrepos/emacs:exiftool.svg exiftool.el is available from [[https://melpa.org/][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. #+BEGIN_SRC emacs-lisp (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") ...) #+END_SRC *** (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. #+BEGIN_SRC emacs-lisp ;; 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")) #+END_SRC *** (exiftool-copy SOURCE DESTINATION &rest TAGS) Copy TAGS from SOURCE file to DESTINATION file. If no TAGS are specified, copy all tags from SOURCE. #+BEGIN_SRC emacs-lisp ;; 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") #+END_SRC ** 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 #+BEGIN_SRC sh make check #+END_SRC * Contributing Feedback, suggestions, feature requests, bug reports and patches are all welcome. Please contact me by mail at [[mailto:arunisaac@systemreboot.net][arunisaac@systemreboot.net]]. * License exiftool.el is free software released under the terms of the [[https://www.gnu.org/licenses/gpl.txt][GNU General Public License]], either version 3 of the License, or (at your option) any later version.