- From: Matt Biddulph <mb@picdiary.com>
- Date: 03 Aug 2002 19:18:39 +0100
- To: www-rdf-interest@w3.org
I was discussing picture metadata with some people this morning and decided to have a play with the Adobe XMP toolkit [1]. Here are my notes, in case they are of use or interest to anyone. job 1: compile under linux, which is unsupported * the code compiles with warnings if you apply these small changes across the .c, .cpp and .h files: * s/xap_xpdomconf.h/XAP_XPDOMConf.h/g * s/XPDom.h/XPDOM.h/g * s/XAPTkinternals.h/XAPTkInternals.h/g * tsk tsk to adobe for developing on a case-insensitive OS but putting mixed-case filenames in their zipfiles * also, some files use FREE, REALLOC, CALLOC and MALLOC macros which presumably would get correctly resolved via a chain of ifdefs and stuff if i were on windows, but for now just #define them to regular libc free, realloc, calloc and malloc * then compile everything with gcc/g++ version 3 * i should make a Makefile really, but i'm too dumb so I just muck about on the cmdline * the sample XAPDumper also needs the PacketScanner utility to compile, but that's also in the distribution and compiles OK (perhaps with similar case-changes for include files) * having done this, i end up with a bunch of apparently working code, but I am getting some segfaults on exit * i shall run a memory profiler when i get a round tuit job 2: try the dumper * as you'd hope, the PDF files that document the XMP toolkit themselves have XMP embedded * so I ran the dumper on XMPEmbedding.pdf and got this dump [2] * and here's a nice w3c rdf validator visualisation of the metadata [3] job 3: insert XMP into JPEG as described in XMPEmbedding.pdf * now, time to write some C++ using the toolkit * I used the MetaXAP object to create a new chunk of rdf describing a jpeg as having dc:creator David Brophy * that gets rendered to RDF/XML and the UtilityXAP object creates an 'xml packet' wrapper around the metadata * i now have a string ready to insert into a jpeg * i use libexif5 and something named 'libjpeg' extracted from the source distribution of the 'exif' command to add data to the existing jpeg file * this goes in an APP1 segment that starts with a length value and the null-terminated string 'http://ns.adobe.com/xap/1.0/', followed by the <?xpacket begin='\x{FEFF}' id='W5M0MpCehiHzreSzNTczkc9d'?> ... <?xpacket end='w' ?> wrapper created by the toolkit * the resulting jpeg [4] still renders correctly as a jpeg, and also contains xmp data giving dc:creator as David Brophy * and works as expected with dan brickley's XMP demo: * extracted metadata: [5], raw RDF/XML: [6] * the slightly shoddy code that does job 3 is available [7] References 1. http://www.adobe.com/products/xmp/ 2. http://www.picdiary.com/~mattb/misc/xmpdump.txt 3. http://www.picdiary.com/~mattb/misc/xmpdump.png 4. http://www.picdiary.com/~mattb/misc/xmp.jpg 5. http://www.w3.org/2001/sw/Europe/200206/imagemeta/extract/extract?uri=http://www.picdiary.com/~mattb/misc/xmp.jpg&html=true 6. http://www.w3.org/2001/sw/Europe/200206/imagemeta/extract/extract?uri=http://www.picdiary.com/~mattb/misc/xmp.jpg&html=false 7. http://www.picdiary.com/~mattb/misc/xmptest.cpp Cheers, Matt.
Received on Saturday, 3 August 2002 14:21:57 UTC