Repository navigation
Take TIFF geometry tags from the image when saving - #10366
Open
aclark4life wants to merge 2 commits into
Open
aclark4life wants to merge 2 commits into
aclark4life wants to merge 2 commits into
Conversation
When saving with libtiff, only BITSPERSAMPLE was taken from the image. IMAGEWIDTH, IMAGELENGTH, SAMPLESPERPIXEL and PLANAR_CONFIGURATION could be overridden by tiffinfo, exif or the original file's IFD. Since ec5f1cb, values describing a larger row than the image raise an OSError; other values could still produce an invalid file. Use the image's geometry for all of these tags instead. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
radarhere
force-pushed
the
libtiff-geometry-tags
branch
from
October 31, 2026 09:28
eed2e5f to
3a03997
Compare
Member
|
If the concern is that it could 'read past the end of the row buffer', then #10226 will raise an error from C for the If the argument is that we know what is correct, and the user shouldn't be able to shoot themselves in the foot by overriding these settings, then I think that argument applies when saving without libtiff as well. I've pushed a commit to prevent the user from overriding |
radarhere
force-pushed
the
libtiff-geometry-tags
branch
from
October 31, 2026 09:31
3a03997 to
cae0858
Compare
radarhere
approved these changes
Oct 31, 2026
radarhere
force-pushed
the
libtiff-geometry-tags
branch
from
October 31, 2026 09:47
cae0858 to
2983d48
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When saving a TIFF with libtiff, only BitsPerSample was taken from the image. ImageWidth, ImageLength, SamplesPerPixel and PlanarConfiguration could be overridden by
tiffinfo,exifor the IFD of the original file.This PR sets all of these tags from the image before the
tiffinfo/exifmerge, so the saved file always matches the image.test_geometry_tagsnow checks that the saved image is unchanged, rather than that the save is rejected, and covers ImageLength and PlanarConfiguration as well.