olive-groves / butterfly_viewer

Side-by-side image viewer with synchronized zoom and sliding overlays. Drag and drop to instantly compare multiple images on your desktop. Very open source.
https://olive-groves.github.io/butterfly_viewer/
Other
36 stars 5 forks source link

[Bug] Certain TIFF files are not openable; "Can't read" dialog thrown #34

Closed larsmaxfield closed 6 months ago

larsmaxfield commented 9 months ago

Certain TIFF files don't open in the Viewer.

Specifically, these TIFFs cause a "Can't read" dialog to appear when dragged into the Viewer. If opened with the sliding overlay creator, they simply don't load.

The TIFFs specifically have dimensions larger than 20000×20000 px, are 24-bit, and are LZW compressed. They are stitched images generated using NumPy and OpenCV. They can be opened with Windows Photos without issue. But when I load them from file with QPixmap() (which is the method with which an image window is instantiated in the Viewer), the result is None.

(What I know to be) TIFFs of a similar source of dimension smaller than 20k×20k can be opened by the Viewer. However, these smaller images were stitched and saved with a process different than that of the troublesome TIFFs.

Hence, it seems the problem lies somewhere in the saving of the images and/or the handling of those images in the Viewer.

larsmaxfield commented 8 months ago

To troubleshoot this, start with a simple PyQt script that attempts to open one of the offending TIFFs in a window (in a QLabel for example). This alone can see if it's PyQt who can't handle big TIFFs.

larsmaxfield commented 6 months ago

This issue also occurs with JPEGs larger than approximately 20000x20000 px.

larsmaxfield commented 6 months ago

One could solve this by tiling images which are too big:

This tiling would likely require OpenCV or some other image processing library.

larsmaxfield commented 6 months ago

Upstream issue with Qt. Not to be solved... for now.