Recent

Author Topic: fcl-image, how to read if an image is grayscale  (Read 1231 times)

han

  • Jr. Member
  • **
  • Posts: 65
fcl-image, how to read if an image is grayscale
« on: February 18, 2019, 11:07:37 am »
Using fcl-image, I can write 16 bit grayscale images E.g.

Code: [Select]
  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:
Code: [Select]
  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

« Last Edit: February 20, 2019, 09:21:14 pm by han »

circular

  • Hero Member
  • *****
  • Posts: 3341
    • Personal webpage
Re: fcl-image, how to read if an image is grayscale
« Reply #1 on: February 21, 2019, 11:24:30 pm »
There an ImageCount and Images property where you can access the TTiffIFD structure. From there you have all the properties of the image.
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018