drewnoakes / metadata-extractor-dotnet

Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
Other
934 stars 165 forks source link

PNG file with other keywords/unexpected data #320

Closed reinfallt closed 2 years ago

reinfallt commented 2 years ago

Here is another weird png file: https://drive.google.com/file/d/1mKhXLAafXUb0C6OXrtQtNwRPNVyXlJNn/view?usp=sharing

The parsing mainly has two issues:

  1. The keyword for the exif text chunk is "Raw profile type EXIF" instead of "Raw profile type exif". This can be easily fixed by either making the comparison case insensitive or just compare against the other one explicitly.

  2. The text chunk with keyword "Raw profile type APP1" actually contains XMP data and not exif data. I did some experiments trying to get it to work (https://github.com/reinfallt/metadata-extractor-dotnet/tree/png_xmp_in_app1_chunk) but I still get an "Error processing XMP data: Unsupported Encoding" from the actual XMP parsing. I didn't debug into the XMP parsing to see what goes wrong.

reinfallt commented 2 years ago

The latest fixes in my branch now makes this file work. I think the code looks a bit messy though so I don't know if I should do a pull request or do some refactoring first. It would probably be good to refactor the XmpReader to be able to call it directly instead of having to do a if/else on the different xmp preambles in the PngMetadataReader.

drewnoakes commented 2 years ago

Feel free to create a PR. It'll make discussing the change easier.