Message from 2022
This post is pretty old! Opinions and technical information in it are almost certainly oudated. Commands and configurations will probably not work. Consider the age of the content before putting any of it into practice.
So while I was able to easily rip out XMP data from a JPEG, actually parsing it looks harder, for several reasons:
- It’s XML, which means that there’s either expat which has lots of callbacks you have to do, and C just doesn’t feel right with that.
It’s RDF, so even if you get the XML turned into a tree, all the libraries that deal with it see it as a digraph. Sample function from a library that deals with RDF:
librdf_iterator* librdf_model_get_arcs (librdf_model *model, librdf_node *source, librdf_node *target);
It’s XMP, so you have to worry about padding out the result and sticking it back in a JPEG.
- It’s image metadata, so all you really care about is that it contains key=>value pairs. What fun!