Skip to content

Refine estimate of bytes needed to write a TIFF plane#4395

Open
melissalinkert wants to merge 2 commits intoome:developfrom
melissalinkert:gh-4113
Open

Refine estimate of bytes needed to write a TIFF plane#4395
melissalinkert wants to merge 2 commits intoome:developfrom
melissalinkert:gh-4113

Conversation

@melissalinkert
Copy link
Member

Fixes #4113.

Instead of just doubling the number of pixel bytes, estimate the number of bytes needed to write the corresponding IFD. As a consequence, this adds methods to get the number of bytes needed to write an IFD and the IFDType for a particular value.

The test case in #4113 should now successfully convert without exception:

bfconvert "test&sizeX=12000&sizeY=20000&sizeZ=8&sizeT=2.fake" test.tiff

and the resulting file should be less than 4GB and readable as expected. Increasing the plane count in the test case should continue to throw an exception indicating that BigTIFF is required (but this is expected).

Given that this adds some new API to the TIFF classes and 8.4.0 is rapidly approaching, I'd be OK with pushing this PR to the next milestone if more time to review/discuss would be helpful.

Fixes ome#4113.

Instead of just doubling the number of pixel bytes,
estimate the number of bytes needed to write the corresponding IFD.
As a consequence, this adds methods to get the number of bytes
needed to write an IFD and the IFDType for a particular value.
@melissalinkert melissalinkert added this to the 8.4.0 milestone Jan 6, 2026
@melissalinkert melissalinkert requested a review from sbesson January 6, 2026 23:11
Boolean values aren't written to IFDs, but are often included
for keeping track of things like whether the IFD should be written
using BigTIFF.
@melissalinkert melissalinkert modified the milestones: 8.4.0, 8.5.0 Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TiffWriter: incorrect BigTIFF threshold

1 participant