Saving pyramid for multidimentional tiff.
See original GitHub issueHi John.
The tiff format should be able to support saving pyramids, I’ve asked that question here : https://github.com/ome/design/issues/104
in pyvips, I am able to save a 2D image with a pyramid fine, and then get the layer of the pyramid with the page argument in tiffload.
But if I save a tiff image with just 2 dimentions (for instance, z =2 ) and save it with the pyramid=True argument, it doesnt seem to work.
Minimum working example. teststack.tif is here : teststack.zip
import pyvips
img2d = pyvips.Image.tiffload("teststack.tif")
img3d = pyvips.Image.tiffload("teststack.tif", n=2)
img2d.tiffsave("img2d.tif", pyramid=True, tile=True)
img3d.tiffsave("img3d.tif", pyramid=True, tile=True)
img2dback = pyvips.Image.tiffload("img2d.tif", page=1)
img3dback = pyvips.Image.tiffload("img3d.tif", page=1)
print(img2dback)
print(img3dback)
Which gives
<pyvips.Image 300x300 uchar, 3 bands, srgb>
<pyvips.Image 600x600 uchar, 3 bands, srgb>
Is there any way to retrieve the pyramid of the image which contains an image in the z dimension?
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Raster pyramids—ArcGIS Pro | Documentation
Pyramids are used to improve display performance. They are a downsampled version of the original raster dataset and can contain many downsampled layers....
Read more >TIFF, Pyramid
Pyramid TIFFs are designed to support efficient zooming to different spatial resolutions, by storing the same image at multiple resolutions.
Read more >SubResolution of Multi-Dimensional Data - Image.sc Forum
Now I am trying to implement saving of sub-resolutions. ... reading TIFF images, which don't expect TIFF data to be more than 2D...
Read more >arcpy - Why ExportToTIFF() gets TIFFs without pyramids?
What I want to do is to add layers (which are TIFF files) one by one to the current MXD file, and export...
Read more >Numpy array to generic-tiff (tiled) with pyramid structure
I have already tried using PIL, tifffile, libtiff but none of these libraries save the numpy array in the generic-tiff format compatible ...
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
Ooop, sorry, you’re right. As you say, 8.10 is subifd pyramids, 8.11 is jp2k.
I’ve added the doc updates to git master pyvips (will be 2.1.16), thanks for the reminder.
For anyone finding this issue. From @jcupitt’s previous answer.
He specifies libvips 8.11, but links to the 8.10 documentation. 8.10 seems to work just fine.
In 8.11 jpeg2000 is added. https://forum.image.sc/t/libvips-8-11-is-out-and-adds-support-for-ome-tiff-with-jpeg2000-compression/53787
In order to use jpeg2000 and not jpeg.
change compression="jpeg" to compression="jp2k"
However, it seems that “jp2k” is missing from https://libvips.github.io/pyvips/enums.html#pyvips.enums.ForeignTiffCompression