Dear Wayne,
thank you very much for these insights!
You confirm my conjecture that there is no easy way around the problem.
Actually, I came across this problem when assisting a poster on
stackOverflow:
<https://stackoverflow.com/a/78852441>
(So no problem for me.)
Kind regards and thanks again
Herbie
::::::::::::::::::::::::::::::::::::::::::
Am 12.08.24 um 20:57 schrieb Wayne Rasband:
Dear Herbie,
I don’t know how to save a 16-bit image with a LUT in PNG format. ImageJ uses
the Java ImageIO.write() method to save in PNG format but this method requires
a BufferedImage and there isn’t a TYPE_USHORT_INDEXED image type, only
TYPE_USHORT_GRAY.
-wayne
On Aug 10, 2024, at 5:22 AM, Herbie <[email protected]> wrote:
Dear specialists and Wayne,
maybe it's a property of the PNG-file format that a 16bit image with monochrome
LUT is saved as 8bit with such a LUT.
Below please find a demo macro that saves and re-opens a 16bit image with green
LUT in TIF-format and PNG-format as well as without LUT in PNG-format.
//
dir=getDir("temp");
newImage("Test","16-bit ramp",192,192,1);
save(dir+"test.png");
run("Green");
save(dir+"testLUT.tif");
save(dir+"testLUT.png");
close();
open(dir+"testLUT.tif");
open(dir+"testLUT.png");
open(dir+"test.png");
run("Tile");
exit();
//
Of course the TIF-image with LUT and the PNG-image without LUT open as 16bit
images, not so the PNG-image with LUT that opens as 8bit image.
Is this a property of the PNG-file format?
Are there ways to get around the implicit 8bit-conversion?
Thanks for possible insights
Herbie
::::::::::::::::::::::::::::
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html