I've been trying to understand how XMP metadata worked on PNG files for the last few hours but couldn't quite wrap my head around it.
If I create a PNG image with Photoshop, save it and open the File Info dialog (File > File Info or Ctrl+Alt+Shift+I), I can see some XMP properties like CreateDate
, CreatorTool
or ModifyDate
.
Now if I try to open the file with exiv2 and read the metadata it seems to not find anything:
auto image = Exiv2::ImageFactory::open(imagePath);
image->readMetadata();
Exiv2::XmpData &xmpData = image->xmpData();
The same goes with the exiftool -xmp:all myImage.png
, exiv2 -P X myImage.png
, or even GIMP (but I think it is using exiv2 internally).
This wouldn't be such an issue if any added metadata were not removed when saving again with Photoshop. In case this wasn't clear, opening the image and adding XMP metadata with exiv2, saving it, opening the image back in Photoshop and in the file info dialog, the properties added previously are not there any more.
The weird thing is that if you do this entire process with a JPEG image, everything works as expected: all the properties are visible from both Photoshop and exiv2 and if I try to add metadata with exiv2 (using the same code), it appears in Photoshop as well.
Am I missing something obvious? Is there anything special about PNGs that is not true for JPEGs? I haven't tried to use Adobe's SDK to edit the XMP data, is it any better?
Any help would be much appreciated as this is starting to drive me crazy :/
Edit: After reading this post I tried with Adobe Bridge and it doesn't seem to display the same properties as Photoshop. If I add XMP metadata with Exiv2 they are displayed in Bridge but if I modify the image in Photoshop, the metadata is gone from Bridge again.