Skip to content
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

Fixed saving TIFF multiframe images with LONG8 tag types #7078

Merged
merged 1 commit into from
Jun 13, 2023

Conversation

radarhere
Copy link
Member

Resolves #7077

The issue points out that

fieldSizes = [
0, # None
1, # byte
1, # ascii
2, # short
4, # long
8, # rational
1, # sbyte
1, # undefined
2, # sshort
4, # slong
8, # srational
4, # float
8, # double
]

does not include 'long8', which we first started supporting in #6097.

This PR adds 'long8', https://www.awaresystems.be/imaging/tiff/bigtiff.html

TIFF_LONG8 = 16, being unsigned 8byte integer

but because fieldSizes is a list not a dictionary, the items between 12 ("12 = DOUBLE") and 16 also need to be added.

https://www.awaresystems.be/imaging/tiff/specification/TIFFPM6.pdf

TIFF data type 13, “IFD,” is otherwise identical to LONG

So 'ifd' has size 4, like long.

For 14 and 15, information is scarce. The best information I could find was
https://android.googlesource.com/platform/external/dng_sdk/+/refs/heads/master/source/dng_tag_types.h

ttByte = 1,
ttAscii,
ttShort,
ttLong,
ttRational,
ttSByte,
ttUndefined,
ttSShort,
ttSLong,
ttSRational,
ttFloat,
ttDouble,
ttIFD,
ttUnicode,
ttComplex

https://android.googlesource.com/platform/external/dng_sdk/+/refs/heads/master/source/dng_image_writer.cpp#325

// Two byte entries.
...
  case ttUnicode:
...
// Four byte entries.
...
  case ttComplex:

@radarhere radarhere added the TIFF label Apr 9, 2023
@radarhere radarhere changed the title Added further TIFF field sizes Fixed saving TIFF multiframe images with LONG8 tag types Apr 9, 2023
@hugovk hugovk merged commit ae92195 into python-pillow:main Jun 13, 2023
@radarhere radarhere deleted the long8 branch June 13, 2023 21:50
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.

Saving TIFF stack does not support tags with type long8
2 participants