Fwd: OpenSlide library inquiry

Benjamin Gilbert bgilbert at cs.cmu.edu
Mon Jun 4 23:06:31 EDT 2012

On 06/04/2012 07:39 PM, David Gutman wrote:
> Ben--- I've been using vips to transcode  raw SVS files into pyramidal
> tiff files... and it works as long as the images are not JPEG2000 encoded.
> vips im_vips2tiff  INPUT_SVS_FILE.svs
> OUTPUT.dzi.tif:jpeg:75,tile:256x256,pyramid,,,,8
> Basically the above command tells VIPS to transcode the original SVS
> file (layer 0) into a pyramidal tiff at 75% quality as a jpeg, at
> 256x256 tiles--- the "8" at the end tells it to save it as a BIGTIFF
> image.  I use the dzi.tif  extension to remind me it's a deep
> zoom/pyramidal tiff file...

Actually, Deep Zoom is a particular file format, unrelated to TIFF.

> Do you think it would be possible to use VIPS/OpenSlide together to
> accomplish the same thing in a single python script?    With the recent
> integration/support of VIPS and OpenSlide that I saw I was hoping this
> possible, but haven't delved into the details.

I haven't looked at the VIPS Python bindings, but if you have VIPS >= 
7.28.3 linked against OpenSlide, it should be straightforward.  You can 
also do this directly from the VIPS command line.  The obvious approach 
with "vips tiffsave" does *not* work, because the TIFF writer gets 
confused by the fourth (alpha) channel returned by OpenSlide.  But you 
can use im_extract_bands:

	vips im_extract_bands INPUT.svs \
		OUTPUT.tif:jpeg:75,tile:256x256,pyramid,,,,8 0 3

--Benjamin Gilbert

More information about the openslide-users mailing list