-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Three TIFF tags cause display issues in GIS software #5838
Copy link
Copy link
Closed
Labels
Description
When I run my GeoTIFF though Pillow while trying to preserve the TIFF info I end up with 3 additional TIFF tags in the output (StripOffsets, RowsPerStrip, StripByteCounts). The resulting output GeoTIFF is now displayed incorrectly in the GIS software ESRI ArcMap (all cell values are now NoData), but is displayed correctly with Pillow or Matplotlib. The input GeoTIFF image is produced with ESRI ArcMap and does not have the 3 extra TIFF tags.
This could of course be an issue with ESRI ArcMap, but I believe the 3 Pillow generated TIFF tags might be wrong. They show up as:
StripOffsets = (810,)
RowsPerStrip = (40,)
StripByteCounts = (6400,)
Input GeoTIFF:
dem_input.zip
from PIL import Image
EXTRA_TIFF_TAGS = {"StripOffsets" : 273, "RowsPerStrip" : 278, "StripByteCounts" : 279}
image_input = Image.open("dem_input.tif")
print([TAG in image_input.tag._tagdata for TAG in EXTRA_TIFF_TAGS.values()]) # [False, False, False]
image_input.save("dem_output.tif", tiffinfo = image_input.tag)
image_output = Image.open("dem_output.tif")
print([TAG in image_output.tag._tagdata for TAG in EXTRA_TIFF_TAGS.values()]) # [True, True, True]
print([image_output.tag[TAG] for TAG in EXTRA_TIFF_TAGS.values()]) # [(810,), (40,), (6400,)]Reactions are currently unavailable