Login  Register

Re: Manage PNG Transparency with ImageJ

Posted by Charles Flond on Dec 28, 2010; 9:19am
URL: http://imagej.273.s1.nabble.com/Manage-PNG-Transparency-with-ImageJ-tp3685645p3685648.html

Hello Wayne,

Thanks for your feedback. Is there a reason why PNG transparency is only
supported for 8-bit images ? Is it possible and / or plan to support
transparency for 16 / 32 bit images ?

Thanks in advance !

Charles

On Mon, Dec 27, 2010 at 10:49 PM, Rasband, Wayne (NIH/NIMH) [E] <
[hidden email]> wrote:

> On Dec 27, 2010, at 12:06 PM, Charles Flond wrote:
>
> > Hi All,
> >
> > Does anybody know how to manage PNG files with transparency using ImageJ
> ? I
> > tried to use the function writeImageWithTransparency(ImagePlus imp,
> String
> > path, int transparentIndex) but it doesn't seem to work.
> >
> > See http://rsb.info.nih.gov/ij/source/ij/plugin/PNG_Writer.java for more
> > details about this function.
> >
> > Any suggestions would be welcomed ! Thanks in advance.
>
> Plugins and scripts can save an 8-bit image as a PNG with transparency
> using
>
>  imp = IJ.getImage();
>  Prefs.setTransparentIndex(index);
>  IJ.saveAs(imp, "PNG", file_path);
>
> where 0<=index<=255. Macros can use
>
>  call("ij.Prefs.setTransparentIndex", index);
>  saveAs("PNG", file_path);
>
> ImageJ does not support display with transparency so you will need to open
> the saved PNG in another application (e.g., a Web browser) to verify that
> the pixels with a value of 'index' are transparent. Note that PNG and GIF
> transparency only works with 8-bit images.
>
> -wayne
>