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

"ValueError: wrong magic number for TIFF file: 43" when trying to read BigTIFF file. #104

Open
markemus opened this issue Mar 26, 2019 · 3 comments

Comments

@markemus
Copy link

markemus commented Mar 26, 2019

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?

@edswangren
Copy link

edswangren commented Aug 19, 2020

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.)

@markemus
Copy link
Author

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.

@phillipjohnson
Copy link

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.

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

No branches or pull requests

3 participants