Using fcl-image, I can write 16 bit grayscale images E.g.
with TFPWriterPNG(Writer) do
begin
indexed := false;
wordsized := true;
UseAlpha := false;
GrayScale := true;
end;
However there seems no way to read these parameters GrayScale or Wordsize in readerPNG. In astronomy grayscale images are very common so I like to read this. Is this not possible or do I oversee something? Same question for the TIFF format.
For the time being I doing the following temporary:
with image do {temporary till reader grayscale is implemented in fcl-image}
grayscale:=((Colors[0,0].red=Colors[0,0].green) and
(Colors[0,0].red=Colors[0,0].blue) and
(Colors[width-1,0].red=Colors[width-1,0].green) and
(Colors[width-1,0].red=Colors[width-1,0].blue) and
(Colors[0,height-1].red=Colors[0,height-1].green) and
(Colors[0,height-1].red=Colors[0,height-1].blue) and
(Colors[width-1,height-1].red=Colors[width-1,height-1].green) and
(Colors[width-1,height-1].red=Colors[width-1,height-1].blue));
Update 2019-2-20. Put in a request to improve the fpreaderPNG:
https://bugs.freepascal.org/view.php?id=35124