Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error opening TIFF in python unknown pseudo-tag

Tags:

python

tiff

I am trying to open a .TIFF image in python. My code is

import numpy as np
import matplotlib.pyplot as plt
from PIL import Image

photos = Image.open("haz(1,8grados).tif")
photos.show()

and I am getting the error

TIFFSetField: tempfile.tif: Unknown pseudo-tag 65538.

Can anyone help with this? I am running python 3 in Mac OS High Sierra.

like image 583
Ivan Burbano Avatar asked Oct 02 '18 21:10

Ivan Burbano


People also ask

What is bad value 0 for orientation tag in TIFF?

convert: example_broken.tiff: Bad value 0 for "Orientation" tag. `_TIFFVSetField' @ error/tiff.c/TIFFErrors/557. (Here, example_broken.tiff is a copy of example.tiff that I’ve purposefully broken.) The value of the Orientation tag describes if the image data should be rotated, mirrored, or rotated and mirrored. It’s value can only be 1-8.

Can a TIFF file contain more than one image?

Because TIFF was developed by scanner manufacturers, a single file can contain multiple images just like a document can contain multiple pages. Since each image may have its own tags, TIFF puts the tags for each image into an Image File Directory (IFD). I’m a TIFF!

Why is it important to avoid these common errors in pseudocode?

It also covers common errors made when writing Pseudocode, because its super important to avoid these common errors in Pseudocode too as quite a lot of exam questions about programming can ask you to write Pseudocode and you don’t want these errors to hold you back from the marker seeing the depth of your understanding.

What does TIFF stand for?

The scanner industry developed the Tagged Image File Format (TIFF) in the 80s as a standard language for their equipment. In a scanner, a sensor rakes across an image line-by-line and records strips of color values.


1 Answers

This is a confirmed bug in PIL / Pillow. It is otherwise an innocent warning, and nothing you need to do differently. You can't silence the warning, however, it is emitted from the TIFF decoding library that PIL depends on.

You can either download the Pillow source code and apply the fix for the bug locally, or wait for the new quarterly release that will be published in January 2019.

like image 146
Martijn Pieters Avatar answered Nov 04 '22 12:11

Martijn Pieters