You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm attempting to load a satellite image from Planet.com by running:
image = Image.open(image_file_name)
pix = image.load()
When my code attempts to run image.load() I receive the above referenced error
What did you expect to happen?
I'm expected the tif image to load to be parsed for vectors
What actually happened?
I receive the error: ValueError: tile cannot extend outside image
What versions of Pillow and Python are you using?
Python 3.6.3 :: Anaconda, Inc
Pillow: 1.1.7
Please include code that reproduces the issue and whenever possible, an image that demonstrates the issue. Please upload images to GitHub, not to third-party file hosting sites. If necessary, add the image to a zip or tar archive.
The best reproductions are self-contained scripts with minimal dependencies. If you are using a framework such as plone, Django, or buildout, try to replicate the issue just using Pillow. PlanetImage.tif.zip PlanetImage.tif.zip
The tiff that you're loading has tiles that extend outside the image boundaries. Basically, the reported size of the image is wrong with respect to the encoded data.
There are two things that can be done, either set the image size to the maximum tile extents, or strip out the tile elements that are outside the reported image size:
The tiff that you're loading has tiles that extend outside the image boundaries. Basically, the reported size of the image is wrong with respect to the encoded data.
FWIW, tiles extending outside the image conform to the TIFF 6.0 specification:
Boundary tiles are padded to the tile boundaries. For example, if TileWidth is 64
and ImageWidth is 129, then the image is 3 tiles wide and 63 pixels of padding
must be added to fill the rightmost column of tiles. The same holds for TileLength
and ImageLength. It doesn’t matter what value is used for padding, because good
TIFF readers display only the pixels defined by ImageWidth and ImageLength
and ignore any padded pixels.
Reacted by Alexander Karpinsky, Jeffrey 'Alex' Clark, Rebecca Stone and Konstantin Kopachev
Activity
wiredfool commentedon Mar 22, 2018
The tiff that you're loading has tiles that extend outside the image boundaries. Basically, the reported size of the image is wrong with respect to the encoded data.
There are two things that can be done, either set the image size to the maximum tile extents, or strip out the tile elements that are outside the reported image size:
or
fowler0503 commentedon Mar 22, 2018
Thanks! That solved it. It also worked when the image was converted to a .png. Does pillow handle .png's differently than .tiff files?
cgohlke commentedon Mar 27, 2018
FWIW, tiles extending outside the image conform to the TIFF 6.0 specification:
nodegin commentedon Jul 19, 2018
Same for this gif image: a28ef5716b5d3f5813d8d08df6c29740f093a635.gif.zip
Looks like the tile is incorrect, reported
image.sizeis (250, 289)im.tile reports (24, 21, 274, 310)
hugovk commentedon Sep 29, 2018
Fixed by #3227.