Hello.
I am trying to convert this file to grayscale using FreeImage (.NET wrapper).
I have successfully converted approximately 1100 similar images to grayscale (it's really fast) using FreeImage.
Call to FreeImage_ConvertToGreyscale function results in null output value.
I can see that there is something strange about the color depth detected by FreeImage (taken from sample 04 of .NET wrapper).
Hi, looking at the code, FreeImage_ConvertToGreyscale does not work with FIT_RGB16 images.
If you don't care about 16bit color, convert first to FIT_BITMAP, then run ConvertToGrayscale.
If you do care about 16bit, I think you can simply convert to FIT_UINT16
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello.
I am trying to convert this file to grayscale using FreeImage (.NET wrapper).
I have successfully converted approximately 1100 similar images to grayscale (it's really fast) using FreeImage.
Call to FreeImage_ConvertToGreyscale function results in null output value.
I can see that there is something strange about the color depth detected by FreeImage (taken from sample 04 of .NET wrapper).
Image is added as attachment.
Info from http://exif.regex.info/exif.cgi added as attachment (.zip).
What do you think is wrong about this image?
Thank you
Last edit: Karel Varel 2021-09-05
Hi, looking at the code, FreeImage_ConvertToGreyscale does not work with FIT_RGB16 images.
If you don't care about 16bit color, convert first to FIT_BITMAP, then run ConvertToGrayscale.
If you do care about 16bit, I think you can simply convert to FIT_UINT16
Per the uploaded PNG file, the BitDepth is 8 and the ColorType 2, hence the Image Type: FIT-RGB16 that you got seems to be a wrong one.
@Johnny Petersen The original is in the zip 5d630284307d0a64696d10b26d13f6af.png
@Mihail Naydenov Thank you, I got it. The original inside the zip is with BitDepth = 16 and ColorType = 2. Without ICC and not interlaced.