Fwd: OpenSlide library inquiry
David Gutman
dagutman at gmail.com
Fri Jun 29 15:43:45 EDT 2012
Thanks--- I checked on anther list serve as well and apparently the
latest version of VIPS changed the default photometric interpretation
to YCbCr because apparently it generated more efficient pyramidal
tiff's...
Thanks for looking into this.
dg
On Fri, Jun 29, 2012 at 2:29 PM, Benjamin Gilbert <bgilbert at cs.cmu.edu> wrote:
> On 06/27/2012 02:58 PM, David Gutman wrote:
>> The files are being written out as YCbCr.... but one of the programs I
>> am using to view these (IIPIMAGE) seems to want RGB images.. Wasn't
>> sure if you knew of a way to transcode to RGB directly--- or if I have
>> to first use VIPS/Openslide to convert it to an LZW/TIFF single layer
>> file then convert it to a "pyramid" for visualization in RGB format..
>
> It looks as though libvips always uses YCbCr subsampling when writing an
> RGB image to a JPEG-compressed TIFF.
>
> From write_tiff_header() in vips2tiff.c: (Irrelevant details removed)
>
> switch( tw->im->Bands ) {
> [...]
> case 3:
> if( tw->im->Type == VIPS_INTERPRETATION_LAB ||
> tw->im->Type == VIPS_INTERPRETATION_LABS )
> photometric = PHOTOMETRIC_CIELAB;
> else if( tw->im->Type == VIPS_INTERPRETATION_CMYK ) {
> photometric = PHOTOMETRIC_SEPARATED;
> TIFFSetField( tif,
> TIFFTAG_INKSET, INKSET_CMYK );
> }
> else if( tw->compression == COMPRESSION_JPEG &&
> tw->im->Bands == 3 )
> /* This signals to libjpeg that it can do
> * YCbCr chrominance subsampling from RGB, not
> * that we will supply the image as YCbCr.
> */
> photometric = PHOTOMETRIC_YCBCR;
> else
> photometric = PHOTOMETRIC_RGB;
>
> break;
> [...]
> }
> TIFFSetField( tif, TIFFTAG_PHOTOMETRIC, photometric );
>
> So if you generate your pyramidal TIFF using LZW instead of JPEG, you'll
> get an RGB photometric interpretation. Of course you'll also get a huge
> file. Or, as you said, you might be able to write a single-layer LZW
> TIFF and then use a different tool to generate the pyramidal file.
>
> --Benjamin Gilbert
> _______________________________________________
> openslide-users mailing list
> openslide-users at lists.andrew.cmu.edu
> https://lists.andrew.cmu.edu/mailman/listinfo/openslide-users
--
David A Gutman, M.D. Ph.D.
Assistant Professor of Biomedical Informatics
Senior Research Scientist, Center for Comprehensive Informatics
Emory University School of Medicine
More information about the openslide-users
mailing list