summaryrefslogtreecommitdiff
path: root/README.org
blob: 9317b74bc5c93cf3e2ffe45e6bf5e008839a5475 (plain)
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
el-exiftool 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, el-exiftool starts an ExifTool process in the
[[http://www.sno.phy.queensu.ca/~phil/exiftool/#performance][-stay_open mode]], and passes all commands to it.

* Functions
  
** High level functions

*** (el-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
  (el-exiftool-read "test1.png" "ImageSize")
  ;; => '(("ImageSize" . "64x64"))
  (el-exiftool-read "test1.png" "ImageSize" "Interlace")
  ;; => '(("ImageSize" . "64x64") ("Interlace" . "Noninterlaced"))
  (el-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

*** (el-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"
  (el-exiftool-write "test1.png" '("Marked" . "True"))
  ;; Set Marked to "True", and Creator to "Foo"
  (el-exiftool-write "test1.png"
		     '("Marked" . "True")
		     '("Creator" . "Foo"))
#+END_SRC

*** (el-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
  (el-exiftool-copy "source.png" "destination.png")
  ;; Copy only the tag Marked
  (el-exiftool-copy "source.png" "destination.png" "Marked")
  ;; Copy only the tags Marked and Creator
  (el-exiftool-copy "source.png" "destination.png" "Marked" "Creator")
#+END_SRC

** Low level functions
   
*** (el-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.

*** (el-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.

* License

el-exiftool 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.