Skip to content

Conversation

brianpopow
Copy link
Collaborator

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

This PR fixes the following issues when encoding tiff images:

  • Write padding byte, because the tiff spec requires ifd offset to begin on a word boundary.
  • Change samples per pixel to ushort

Closes #2297

Copy link
Member

@JimBobSquarePants JimBobSquarePants left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@brianpopow
Copy link
Collaborator Author

There is a failing test, I am trying to figure out if it is a regression introduced with this changes, but I dont know how yet.

@JimBobSquarePants
Copy link
Member

I’ll have a poke at it later.

@JimBobSquarePants
Copy link
Member

@brianpopow There appears to be a corrupted EXIF value in the encoded output. Unknown tag of type byte[] with two entries at the beginning with the rest empty.

image

@brianpopow
Copy link
Collaborator Author

The input image metadata_sample.tiff already seems to be completely broken:

identify: Unknown field with tag 18246 (0x4746) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/950.
identify: Unknown field with tag 18249 (0x4749) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/950.
identify: Unknown field with tag 40091 (0x9c9b) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/950.
identify: Unknown field with tag 40092 (0x9c9c) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/950.
identify: Unknown field with tag 40093 (0x9c9d) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/950.
identify: Unknown field with tag 40094 (0x9c9e) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/950.
identify: Unknown field with tag 40095 (0x9c9f) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/950.
identify: Unknown field with tag 59932 (0xea1c) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/950.
identify: IO error during reading of "Tag 40095"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/950.
identify: F:\vsprojekte\ImageSharp.Playground\tests\Images\Input\Tiff\metadata_sample.tiff: Can not read TIFF directory. `TIFFFetchDirectory' @ error/tiff.c/TIFFErrors/597.
identify: Failed to read custom directory at offset 5596. `TIFFReadCustomDirectory' @ error/tiff.c/TIFFErrors/597.
identify: Unknown field with tag 18246 (0x4746) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/950.
identify: Unknown field with tag 18249 (0x4749) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/950.
identify: Unknown field with tag 40091 (0x9c9b) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/950.
identify: Unknown field with tag 40092 (0x9c9c) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/950.
identify: Unknown field with tag 40093 (0x9c9d) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/950.
identify: Unknown field with tag 40094 (0x9c9e) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/950.
identify: Unknown field with tag 40095 (0x9c9f) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/950.
identify: Unknown field with tag 59932 (0xea1c) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/950.
identify: IO error during reading of "Tag 40095"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/950.

I will try to fix that first.

@brianpopow
Copy link
Collaborator Author

Ok the input file is fixed now. I assume the error in the encoded EXIF profile came from the corrupted input file.

@JimBobSquarePants JimBobSquarePants merged commit 5834c39 into main Nov 21, 2022
@JimBobSquarePants JimBobSquarePants deleted the bp/Issue2297 branch November 21, 2022 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

created/overwritten/copied TIFF images are invalid for Adobe Premiere Pro

2 participants