Is it possible to define the pyramid level count when using tiffsave?
See original GitHub issueI’m a newcomer to vips / pyvips (and GitHub and Coding for that matter) so please excuse any blatant errors within my question.
I’m working with whole slides images of histopathologic slides and was really happy to find that pyvips can actually write / save such files. Additionally, with pyvips.Image.openslideload
one can make use of the OpenSlide library, which we utilize regularly. The problem is, that when I use pyvips.tiffsave
and specify pyramid=True
it changes the number of levels and I have not found a way out of this. The code I try to test this looks something like this:
import openslide
import pyvips
img_os = openslide.OpenSlide("SomeWSI.svs")
img_pv = pyvips.Image.openslideload("SomeWSI.svs")
save = "Test.svs"
img_pv.tiffsave(save, tile=True, compression='lzw', bigtiff=True, pyramid=True, Q=100)
img_new = openslide.OpenSlide("Test.svs")
print("Saved via pyvips: ", img_new.level_count)
print("Original file: ", img_os.level_count)
and the Output is:
Saved via pyvips: 10
Original file: 3
I’m surely missing something so any help would be much appreciated.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Efficiently saving tiles to a bigtiff image - python - Stack Overflow
uint8 and I want to combine those into one BigTiff pyramidical image as fast as possible. My current approach is to create a...
Read more >Image — pyvips 2.2.1 documentation - GitHub Pages
Small images are loaded via memory by default, use VIPS_DISC_THRESHOLD to set the definition of small. access (Access) – Hint the expected access...
Read more >Image pyramids - libvips
It's fast and can generate pyramids for large images using only a small amount of memory. The TIFF writer, vips_tiffsave() can also build...
Read more >tifffile - PyPI
Image data can be read as NumPy arrays or Zarr arrays/groups from strips, tiles, pages (IFDs), SubIFDs, higher order series, and pyramidal levels....
Read more >Save files in graphics formats in Photoshop - Adobe Support
Some applications may not be able to read a CMYK file saved in JPEG format. ... Files with JPEG encoding can be printed...
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
By size, I mean number of pixels.
A 50,000 x 50,000 pixel image will have these layers:
0 = 50,000 1 = 25,000 2 = 12,500 3 = 6,250 4 = 3,125 5 = etc.
The number of levels created by
tiffsave
is set by the size of the image. Larger images will need more levels.