summaryrefslogtreecommitdiff
path: root/README.org
blob: 81c99898d4fbf81a4c6d4319dabe5150fe890186 (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
92
93
94
95
96
97
98
99
100
101
102
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

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 -C tests
#+END_SRC

{{{contact}}}

{{{license(exiftool.el)}}}