1 year ago
#377601
s6hebern
PyQt5: TIFFReadDirectory: Warning, Unknown field with tag XXXXX (0xYYYY) encountered
I have the exact same problem as described under Python: TIFFReadDirectory warning: unknown field with tag: I get tons of annoying warnings from simply loading an image. The only difference is that I'm using PyQt5
to read GeoTiff files. I tried to set up a warning filter, but can't get it right. Here is what I do:
from PyQt5 import QtGui
image = QtGui.QImage('PATH_TO_GEOTIFF')
The warning looks like
TIFFReadDirectory: Warning, Unknown field with tag XXXXX (0xYYYY) encountered.
My filter attempt was:
import warnings
warnings.filterwarnings('ignore')
but it looks like PyQt does not throw a Python warning, but something weird to stdout that the warnings
module does not catch. Or am I missing something really obvious here?
I don't know how to upload a working GeoTiff, in case someone tells me how to do that, I can add a test image.
UPDATE: I found the libtiff-5.dll
in my local GIMP installation and was able to reference it the same way as in the linked question:
import ctypes
libbytiff = ctypes.CDLL(r"c:\Program Files\GIMP 2\bin\libtiff-5.dll")
libbytiff.TIFFSetWarningHandler.argtypes = [ctypes.c_void_p]
libbytiff.TIFFSetWarningHandler.restype = ctypes.c_void_p
libbytiff.TIFFSetWarningHandler(None)
But the warnings still remain.
UPDATE 2: The only Qt-related *tif.dll
I could find is c:\Python310\Lib\site-packages\PyQt5\Qt5\plugins\imageformats\qtiff.dll
, but this immediately gives me AttributeError: function 'TIFFSetWarningHandler' not found
.
python
pyqt5
warnings
geotiff
0 Answers
Your Answer