Skip to content

Added custom int and float TIFF tags - #3350

Merged
hugovk merged 6 commits into
python-pillow:masterfrom
radarhere:custom_tags
Dec 26, 2018
Merged

hugovk merged 6 commits into
python-pillow:masterfrom
radarhere:custom_tags

Conversation

@radarhere

Copy link
Copy Markdown
Member

Resolves #660

@radarhere radarhere added the TIFF label Sep 13, 2018
@radarhere
radarhere force-pushed the custom_tags branch 3 times, most recently from f46139b to 5dc1e0a Compare September 15, 2018 13:01
@radarhere
radarhere force-pushed the custom_tags branch 2 times, most recently from 2ed1d5b to b01e92e Compare September 28, 2018 22:01
Comment thread Tests/test_file_libtiff.py Resolved


def _libtiff_version():
return Image.core.libtiff_version.split("\n")[0].split("Version ")[1]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tiffvers.h:

#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.0.9\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
/*
 * This define can be used in code that requires
 * compilation-related definitions specific to a
 * version or versions of the library.  Runtime
 * version checking should be done based on the
 * string returned by TIFFGetVersion.
 */
#define TIFFLIB_VERSION 20171118

And TIFFGetVersion returns TIFFLIB_VERSION_STR. It's a bit odd they don't return the plain 4.0.9 version.

Anyway, has the version been string been of this form for a long time? Do we feel this splitting to be robust?

Comment thread src/libImaging/TiffDecode.c Outdated
n = sizeof(info) / sizeof(info[0]);

// Test for libtiff 4.0 or later, excluding libtiff 3.9.6 and 3.9.7
#if TIFFLIB_VERSION >= 20111221 && TIFFLIB_VERSION != 20120218 && TIFFLIB_VERSION != 20120922

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the Python side, we're extracting the x.y.z version from TIFFLIB_VERSION_STR.

Here, we're using TIFFLIB_VERSION which is yyyymmdd, and checking it's later than 4.0's date, but excluding some known 3.x which were released later than 4.0.

Do we feel safe that there won't be any more 3.x releases after 4.0? 3.9.7 was six years ago, so that's one sign.

Can we extract the real x.y.z from TIFFLIB_VERSION_STR here instead?

Comment thread src/libImaging/TiffDecode.c Resolved
Comment thread src/libImaging/TiffDecode.c Resolved

}

int ImagingLibTiffMergeFieldInfo(ImagingCodecState state, TIFFDataType field_type, int key){

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's convert this whole file to use spaces not tabs.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They were just in the lines that I added, but done.

Comment thread src/libImaging/TiffDecode.c Resolved
Comment thread src/encode.c Resolved
Comment thread src/encode.c Resolved
Comment thread src/encode.c Resolved
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.

2 participants