Skip to content

Keep the first of duplicate TIFF tags - #10210

Merged
radarhere merged 2 commits into
python-pillow:mainfrom
radarhere:load
Oct 15, 2026
Merged

radarhere merged 2 commits into
python-pillow:mainfrom
radarhere:load

Conversation

@radarhere

@radarhere radarhere commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Sequel to #10201

# 16x16 strip with duplicated BitsPerSample and PhotometricInterpretation
# tags. libtiff keeps the first (8-bit YCbCr, read as 4 bytes/pixel RGBA)
# while Pillow keeps the last (16-bit RGB, rawmode RGB;16N, 6 bytes/pixel).

If libtiff keeps the first of duplicate tags, then let's do the same.

# 16x16 8-bit greyscale tile, with a PhotometricInterpretation tag that
# has two values. Pillow reads it as YCbCr (rawmode RGBX, 4 bytes/pixel)
# while libtiff ignores it and decodes 1 byte/pixel.

If libtiff is ignoring a malformed PhotometricInterpretation tag, then let's do the same.

With these changes, the test no longer fails the C checks from the earlier PR.

The C code can be left in as a defensive measure for when Pillow and libtiff disagree, but this PR stops them from disagreeing in the first place.

@radarhere radarhere added the TIFF label Oct 15, 2026
@radarhere
radarhere merged commit 27af434 into python-pillow:main Oct 15, 2026
52 checks passed
@radarhere
radarhere deleted the load branch October 15, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant