2007-08-19T09:20:22Z
Dave Pawson.
link
Home
Tagging Photographs
I've been looking at metadata in Photographs. I started with
this piece. Had to
update it to work with more recent version of Jena, but it
works. However it omits most of my Canon makertags. Then Sean
found exiftool
which is a really professional bit of software. Does way more
than I will ever need. So I started to stitch together a chain
of apps. Pull the existing Exif data, wrap it to
make it N3 using a
bit of Python, then cwm to
get it into XML/RDF notation. Then finally I can use jpegrdf to
stuff it back into the image, in the comment field. I extended
it this morning to work with a whole directory of
jpegs. Except. I was nattering with Sean yesterday, about
storage and backup and stuff. Then we started talking about
actually using the software, now I have it. My initial thoughts
were to add the sort of comment that you'd find under a
photograph. Aunty Jean at Mablethorpe, 1922,
etc. dc:title, dc:description, perhaps
even geo:lat and geo:long. Seans
comments hurt, as in the truth hurts. Going for longevity, his
suggestion was to add a plain text file in the directory with
the comments I wanted to add. If exif 2.2 has developed into
exif 10.6 by the time the images are seen, then there is a fair
chance that the image metadata will have been lost. The chances
of losing the text file? Nil. Or at least if it's lost, so will
the images. I'm still trying to refute his arguments. I took one
step by stating that XML is as good as text. Perhaps pull the
rdf and save it in the same directory? Then I can keep valid
RDF, yet avoid the trap of burying it in a binary format? The N3
isn't far from readable anyway, despite comments from Jeni.
exif:data a exif:dataset; dc:date "2007-08-17"; # ExifTool - exif:ExifToolVersion "6.94"; # File - exif:FileName "058.Original.jpg"; exif:Directory "."; exif:FileSize "1065 kB"; exif:FileModifyDate "2007:08:19 08:38:34"; exif:FileType "JPEG"; exif:MIMEType "image/jpeg"; etc
The information is there to resolve the association with the file. Then I can add the geo stuff, titles etc as needed. I think you're right Sean.
First time I've knitted together so many bits of programs though. That was quite interesting. I've always been impressed by shell scripting. Still makes me smile when I think back to dos scripts. This was a case very much aligned to the Unix philosophy, take a tool which is good at one thing, and pipe them together to perform larger tasks.
exiftool -a -u -g1 -s -t $1 >tmp.tmp
if [ $? -ne 0 ]
then
echo Error reported by exiftool, quitting
exit 2
fi
python /files/python/exifRDF.py -i tmp.tmp -o tmp.n3
if [ $? -ne 0 ]
then
echo Error reported by exifRDF.py, quitting
exit 2
fi
cwm --n3 tmp.n3 --rdf >tmp.rdf
if [ $? -ne 0 ]
then
echo Error reported by cwm, quitting
exit 2
fi
cd=/apps/jpegrdf
CP=$cd/jpegrdf.jar:$cd:$cd/commons-logging-1.1.jar: \
$cd/icu4j_3_8_d01.jar:$cd/iri.jar:$cd/jena.jar: \
$cd/xercesImpl.jar:$cd/xerces.jar
java -cp $CP com.nwalsh.jpegrdf.JpegRDF -rdf tmp.rdf $1
I like the idea of mixing Perl Python and Java too!
Keywords: exif
Comments (View)Return to main index