Skip to content
This repository was archived by the owner on Jan 7, 2024. It is now read-only.

Commit 73a4ab4

Browse files
committed
Set exif/iptc tags with exiv2. Add comment in readme file.
1 parent 3b1cd35 commit 73a4ab4

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

README.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,32 @@ document which will go public) and you want to give proper credits to images
1515
licensed in the Creative Commons.
1616

1717

18+
Requirements
19+
============
20+
1821
Compilation
19-
===========
22+
-----------
2023

2124
For compilation, you need a working gradle environment (get more information here: http://gradle.org/).
2225
In order to create the standalone jar file, run
2326

2427
gradle dist
2528

2629

30+
External programs
31+
-----------------
32+
33+
flickrdl is able to embed the images' metadata in the EXIF/IPTC section of the image.
34+
This is done by calling one of the following external tools:
35+
36+
* exiftool http://www.sno.phy.queensu.ca/~phil/exiftool/
37+
* exiv2 http://www.exiv2.org/
38+
39+
If one of these two programs is found in the current PATH, it will be used automatically.
40+
If none of them is installed, the only possibility to store the metadata is the creation
41+
of a sidecar file.
42+
43+
2744
Usage
2845
=====
2946

src/main/groovy/de/ploing/flickrdl/FlickrDL.groovy

+14-3
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,25 @@ class FlickrDL {
9292
photo.getTags().each { t ->
9393
cmd += [ "-Keywords+=${t.getValue()}" ]
9494
}
95-
cmd += [ imageFilename ]
95+
cmd += [ '-overwrite_original_in_place', imageFilename ]
9696
def proc = cmd.execute()
9797
proc.waitFor()
9898
}
9999

100100
static addMetadataWithExiv2(photo, imageFilename, path) {
101-
println "Adding metadata to ${imageFilename} with exiv2 ${path}"
102-
101+
def cmd = [ path,
102+
"-Mset Exif.Image.Artist String ${photo.getOwner().getRealName()?:photo.getOwner().getUsername()}",
103+
"-Mset Exif.Photo.UserComment String License: ${licenses.get(photo.getLicense())} Source: ${photo.getUrl()}",
104+
"-Mset Iptc.Application2.Byline String ${photo.getOwner().getRealName()?:photo.getOwner().getUsername()}",
105+
"-Mset Iptc.Application2.Contact String ${photo.getUrl()}",
106+
"-Mset Iptc.Application2.Copyright String ${licenses.get(photo.getLicense())}"
107+
]
108+
photo.getTags().each { t ->
109+
cmd += [ "-Madd Iptc.Application2.Keywords String ${t.getValue()}" ]
110+
}
111+
cmd += [ imageFilename ]
112+
def proc = cmd.execute()
113+
proc.waitFor()
103114
}
104115

105116
static main(args) {

0 commit comments

Comments
 (0)