saving 16-bit PNG: only 8-bit accuracy

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

saving 16-bit PNG: only 8-bit accuracy

Michael Schmid
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.  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
Reply | Threaded
Open this post in threaded view
|

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

Rasband, Wayne (NIH/NIMH) [E]
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