Skip to content

Conversation

@TheZ3ro
Copy link

@TheZ3roTheZ3ro commented Nov 29, 2024

This PR fixes#187

The TIFF6 specification writes:

Value/Offset
To save time and space the Value Offset contains the Value instead of pointing to
the Value if and only if the Value fits into 4 bytes. If the Value is shorter than 4
bytes, it is left-justified within the 4-byte Value Offset, i.e., stored in the lower-
numbered bytes. Whether the Value fits within 4 bytes is determined by the Type
and Count of the field.

python-docx by default uses the Value/Offset field as a offset for ASCII IFD, but sometime the Value/Offset field could contain directly the Value (if it contains a string with 4 or less characters including the final NULL byte/string terminator)

This is the case for the 2 pictures linked in issue #187 (the Software ASCII field contains 8.3)
image

@TheZ3roTheZ3ro changed the title fix Ascii IFD reading as TIFF6.0 specFix Ascii IFD reading as TIFF6.0 specNov 29, 2024
@TheZ3roTheZ3ro mentioned this pull request Nov 29, 2024
@TheZ3ro
Copy link
Author

@scanny can you kindly merge this? Thanks!

@TheZ3ro
Copy link
Author

any news on this? @scanny

Sign up for freeto 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.

add_picture

2 participants

@TheZ3ro@scanny