Our html5 web app lets users upload photos. With javascript in the browser, we currently resize the image, then serialize it with canvas.toDataUrl(). Now we would like to embed some xmp metadata at the client.
Are there existing libraries that will help me do this? There's this for exif, but nothing for XMP, it appears.
If not, is it sane or reasonable to scan the byte array and insert the app1 section with the xmp packet? I have the byte array thanks to this. The adobe docs here describe the construction and embedding of xmp in jpeg, but this is a frightening low level operation for a web front end guy.
You can do this the old way, with binary strings, or the new way, with array buffers. This git repository shows a working script to insert an XMP section in the jpeg returned by canvas.toDataUrl(). The technique could be handy for anyone needing to decompose and modify a jpeg with javascript.