Skip to content
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

LZW compressed tif image not handled properly in Pillow #5015

Closed
rashindrie opened this issue Oct 27, 2020 · 3 comments
Closed

LZW compressed tif image not handled properly in Pillow #5015

rashindrie opened this issue Oct 27, 2020 · 3 comments
Labels

Comments

@rashindrie
Copy link

rashindrie commented Oct 27, 2020

What did you do?

Attempted to read a LZW compressed image as follows:

from PIL import Image
import matplotlib.pyplot as plt

# read file
image = Image.open('test.tif')

# display file as image
plt.imshow(image)
plt.show()

The image was originally converted from .bif to .tif using the below tool and command:
Tool: Command Line Tool from https://www.openmicroscopy.org/bio-formats/

bfconvert -series 2 -compression LZW test.bif test.ome.tif

What did you expect to happen?

The image to be displayed as it is.
image

What actually happened?

The displayed image contains strips across it and is discolored.
image

What are your OS, Python and Pillow versions?

  • OS: Linux
  • Python: 3.7.4
  • Pillow: 7.0.0
@radarhere radarhere added the TIFF label Oct 27, 2020
@kmilos
Copy link
Contributor

kmilos commented Oct 28, 2020

Maybe related to #4621?

@radarhere
Copy link
Member

Neither of the images attached in the post are a TIFF. Could we get a copy of the TIFF that Pillow was given?

@radarhere
Copy link
Member

Testing with http://openslide.cs.cmu.edu/download/openslide-testdata/Ventana/OS-2.bif, ./bfconvert -series 2 -compression LZW test.bif test.ome.tif, and

from PIL import Image
Image.MAX_IMAGE_PIXELS=None  # may not be necessary for your image
im = Image.open("test.ome.tif")
im.show()

I find this is resolved by #5364

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants