Skip to content

test "IPTC" profile type #299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion MetadataExtractor/Formats/Png/PngMetadataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,18 @@ IEnumerable<Directory> ProcessTextChunk(string keyword, byte[] textBytes)
{
if (TryProcessRawProfile(out int byteCount))
{
yield return new IptcReader().Extract(new SequentialByteArrayReader(textBytes), byteCount);
// From ExifTool:
// this is unfortunate, but the "IPTC" profile may be stored as either
// IPTC IIM or a Photoshop IRB resource, so we must test for this.
// Check if the first byte matches IptcReader.IptcMarkerByte (0x1c)
if (byteCount > 0 && textBytes[0] == 0x1c)
yield return new IptcReader().Extract(new SequentialByteArrayReader(textBytes), byteCount);
else
{
foreach (var psDirectory in new Photoshop.PhotoshopReader().Extract(new SequentialByteArrayReader(textBytes), byteCount))
yield return psDirectory;

}
}
else
{
Expand Down