Login  Register

Re: saving 16-bit PNG: only 8-bit accuracy

Posted by Rasband, Wayne (NIH/NIMH) [E] on Aug 21, 2013; 3:31am
URL: http://imagej.273.s1.nabble.com/saving-16-bit-PNG-only-8-bit-accuracy-tp5004502p5004514.html

On Aug 20, 2013, at 6:05 AM, Michael Schmid wrote:

> Hi everyone,
>
> as far as I understand, ImageJ should be able to save 16-bit PNG images.
> As far as I could determine, if I open a 16-bit image saved as .png, the
> accuracy is 8 bits.

This bug is fixed in the ImageJ 1.48b daily build.

-wayne

> Here is an example macro:
>
> newImage("Untitled", "32-bit ramp", 512, 512, 1);
> run("Square");
> resetMinAndMax();
> run("Conversions...", "scale weighted");
> run("16-bit");
> //now we have a 16-bit image with data that are not a multiple of 256
> saveAs("PNG", getDirectory("home")+"/test-16bit.png");
> rename("original");
> open(getDirectory("home")+"test-16bit.png");
> imageCalculator("Subtract create 32-bit", "test-16bit.png","original");
>
> Reading the 16-bit png gives me data values of only 0, 257, 514, etc; all
> multiples of 257.
>
> Same with the daily build, 1.48a, 1.47a, Java 1.6 (Mac) and 1.5
> (Windows/Wine).
>
> Is this intended?
>
> Michael
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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