1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
#+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.
|