imageio v3 api reads all pages of a multipage TIFF at once
See original GitHub issueI have a two-page TIFF, one 8bit grayscale image of shape (15,10) per page, and I am expecting imageio.v3.imiter
to iterate over the two pages. Yet, it reads them both at once:
>>> from skimage import data_dir
>>> file = data_dir + '/multipage.tif'
>>> import imageio
>>> len([*imageio.v3.imiter(file)])
1
>>> for img in imageio.v3.imiter(file):
... img.shape
...
(2, 15, 10)
The same code prior to #805 fulfills my expectation and iterates over the two pages:
>>> from skimage import data_dir
>>> file = data_dir + '/multipage.tif'
>>> import imageio
>>> len([*imageio.v3.imiter(file)])
2
>>> for img in imageio.v3.imiter(file):
... img.shape
...
(15, 10)
(15, 10)
The TIFF file in question is part of skimage
: https://github.com/scikit-image/scikit-image/blob/c95a8fd46a49a38de1f6032c84d9d61160b78283/skimage/data/multipage.tif
It appears to have been created with ImageMagick.
Issue Analytics
- State:
- Created a year ago
- Comments:11 (9 by maintainers)
Top Results From Across the Web
imageio v3 api fails to read all frames in a MetaMorph stk file · Issue ...
FWIW, STK files are not regular TIFF. They store "frames" not in separate TIFF pages but contiguously after the image data of the...
Read more >Core API v3 — imageio 2.22.4 documentation
This API provides a functional interface to all of ImageIOs backends. ... Useful if the format supports storing more than one (GIF, multi-page...
Read more >Writing multipage TIFF with Python
An easy, robust way to write multipage TIFF on any platform in Python is imageio. For all examples below, assume a stack of...
Read more >Splitting a multipage TIFF image into individual images (Java)
You can use the Java Advanced Imaging library, JAI, to split a mutlipage TIFF, by using an ImageReader: ImageInputStream is = ImageIO.
Read more >imageio Documentation - Read the Docs
import imageio.v3 as iio. # index=None means: read all images in the file and stack along first axis frames = iio.imread("imageio:newtonscradle.gif", ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@FirefoxMetzger good luck with your thesis!! 😃
@FirefoxMetzger Thanks for the reply!
I guess you are right. However, since
contiguous=True
used to be the default (and I wasn’t even aware of this option), I have now a lot of old files with all images in a single series, and I guess I am not the only one. This was just one example illustrating why I find it useful to be able to read individual pages. The other, more concerning one is commercial software over which we have no control writing all images into a single series.I wasn’t thinking about permanently reverting #816, but only until there is another way to load single pages (i.e., #914 is merged). I really appreciate your work moving imageio forward!
Cool, I will have a look.