Login  Register

Re: Applying LUT to PNG image changes bit

Posted by ctrueden on Apr 15, 2015; 7:09pm
URL: http://imagej.273.s1.nabble.com/Applying-LUT-to-PNG-image-changes-bit-tp5012460p5012495.html

Hi Wayne,

> as far as I know, there is no way to create a 16-bit BufferedImage
> that has a lookup table.

You can, but you need a custom ColorModel. Bio-Formats does it [1, 2, 3, 4,
5].

But I doubt the ImageIO.write call would work with it!

Regards,
Curtis

[1]
https://github.com/openmicroscopy/bioformats/blob/v5.1.0/components/formats-bsd/src/loci/formats/gui/Index16ColorModel.java#L43-L46
[2]
https://github.com/openmicroscopy/bioformats/blob/v5.1.0/components/formats-bsd/src/loci/formats/gui/AWTImageTools.java#L793-L808
[3]
https://github.com/openmicroscopy/bioformats/blob/v5.1.0/components/formats-bsd/src/loci/formats/gui/AWTImageTools.java#L1948-L1958

On Mon, Apr 13, 2015 at 6:49 PM, Rasband, Wayne (NIH/NIMH) [E] <
[hidden email]> wrote:

> On Apr 13, 2015, at 6:24 PM, Neil Fazel <[hidden email]> wrote:
> >
> > When I apply an LUT to a 16-bit PNG image and save it, it is saved as an
> 8-bit PNG image. Is this the expected behavior? My understanding was that
> applying a lookup table to an image should not change the image type (e.g.
> bit depth) when the image is saved.
>
> Applying a lookup table does not change the bit depth when saving in TIFF
> format. This is not the case when saving in PNG format because 16-bit
> images are saved using
>
>    ImageIO.write(BufferedImage, "png", File)
>
> and, as far as I know, there is no way to create a 16-bit BufferedImage
> that has a lookup table.
>
> -wayne
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html