11-08-2009 09:00 PM
Hi Thomas -
A little more investigation shows it's not to do with the image size, but with the range of values in the image. If you have a 2-pixel image with values of -32768 and 0, it seems to read ok. It seems that the .NET routine may be rescaling any image that doesn't contain 16 bits of information to "fill" the 16-bit range, but not retaining individual values - looks like the minimum is always -32768. I've looked on MSDN but noone has discussed anything similar as far as I can see. You may wish to look there further, and ask what is going on. The pixel format for these 16-bit images is Gray16.
For the RGB images, the pixel formats are either Bgr24 (when PreservePixelFormat is selected) or Bgr32 (for None), so there is no alpha channel recovered in either case.
Sorry I can't be of more help.
Cheers ~ Greg
10-09-2015 12:09 PM
10-09-2015 12:19 PM
...and here is the code...
04-10-2017 06:15 AM
Fianlor: Your post does not deal with the issue of decoding the PNG and the example stacked sequence structure is very unreadable.
To the original subject of this thread: Thank you, guys, very much for your code. It is really practical and it works fairly fast. I wonder whether there will ever be a Read PNG From String function, possibly with RT support, but this one works great!