Login  Register

saving 16-bit PNG: only 8-bit accuracy

Posted by Michael Schmid on Aug 20, 2013; 10:05am
URL: http://imagej.273.s1.nabble.com/saving-16-bit-PNG-only-8-bit-accuracy-tp5004502.html

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