pylibtiff
pylibtiff copied to clipboard
"ValueError: wrong magic number for TIFF file: 43" when trying to read BigTIFF file.
To replicate:
from libtiff import TIFFfile
path = "/path/to/BigTIFF.tif"
TIFFfile(path)
It says it's checking the magic number, but actually it's checking the version number. Bigtiffs have version number 43 instead of 42. Are bigtiffs actually not supported or is it supposed to be checking the magic number?
I took a look at the source and it seems that BigTIFF files are explicitly not supported (there's a hard check on "42"). I ask because I'm getting an error reading STRIPE_OFFSETS from the ctypes API and I'm trying to figure out if the issue is in the way I'm writing the file or my version of libtiff. File can be read fine on windows and by matlab on windows or linux, but I get errors on linux with this package as well as tiffinfo (so I don't believe it's PyLibTiff specifically, just working through it.)
I'm still not sure if this is a bug or a typo - it claims it's checking the magic number but it's actually checking the version number. The version number was originally always supposed to be 42 but bigtiff changes it to 43.
Bigtiff does have the same magic numbers as standard tiff, so if it's supposed to be checking that then this would be a bug. Otherwise the wording should change to indicate that it's the version numbers that don't match.
I'm also having this problem, I'm using a BigTIFF-compliant version of libtiff
:
LIBTIFF, Version 4.0.3
Copyright (c) 1988-1996 Sam Leffler
Copyright (c) 1991-1996 Silicon Graphics, Inc.
Issue #70 seems to suggest that BigTIFF is supported, but the source code seems to disagree with that.