-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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: tile cannot extend outside image #3044
Comments
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: >>> im = Image.open('issue_3044.tif')
>>> im.tile
[('raw', (0, 0, 128, 128), 2829, ('RGB', 0, 1)),
('raw', (128, 0, 256, 128), 51981, ('RGB', 0, 1)),
...
('raw', (2048, 1280, 2176, 1408), 9636621, ('RGB', 0, 1)),
('raw', (2176, 1280, 2304, 1408), 9685773, ('RGB', 0, 1))]
>>> im.size = (2304, 1408)
>>> im.show() or >>> im = Image.open('issue_3044.tif')
>>> im.tile = [e for e in im.tile if e[1][2] < 2181 and e[1][3]<1294]
>>> im.show() |
Thanks! That solved it. It also worked when the image was converted to a .png. Does pillow handle .png's differently than .tiff files? |
FWIW, tiles extending outside the image conform to the TIFF 6.0 specification:
|
Same for this gif image: a28ef5716b5d3f5813d8d08df6c29740f093a635.gif.zip Looks like the tile is incorrect, reported |
Fixed by #3227. |
What did you do?
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 text was updated successfully, but these errors were encountered: