FPReaderPNG doesnt read 16bit Gray (single channel) PNG files lazarus / 39-Graphics ---------------------------------------------------------------------- CorBee · 2014-11-19 20:02 Hi, I am developing an application where I need to be able to read 16bit single channel gray PNG images. The FPReaderPNG does allow me to read the images but the data that I get from the images is only the upper 8 bits of the 16bit data. Other 16bit PNG files do work as planned. Anybody with an idea where to fix this ? kind regards CorBee ************************************************* RegiStax Free Image Processing Software http://www.astronomie.be/registax ************************************************* ---------------------------------------------------------------------- Timewarp · 2014-11-19 20:25 http://bugs.freepascal.org/view.php?id=24382 ---------------------------------------------------------------------- CorBee · 2014-11-19 20:40 Thanks. So an unresolved issue .. ---------------------------------------------------------------------- Timewarp · 2014-11-19 21:03 Quote from: CorBee on November 19, 2014, 09:40:58 pmSo an unresolved issue ..And expected to remain (unless someone commits the patch) BGRABitmap has this fix included. ---------------------------------------------------------------------- CorBee · 2014-11-19 21:29 In BGRABitmap I see this routine function TBGRAReaderPNG.ColorGray16 (const CD:TColorDAta) : TFPColor; var c : NativeUint; begin   c := CD and $FFFF;   with result do     begin     red := c;     green := c;     blue := c;     alpha := alphaOpaque;     end; end; Thats no different from the routine in FPreadPNG. ---------------------------------------------------------------------- Timewarp · 2014-11-19 21:52 Problem is in ColorGrayAlpha16 Are you sure your images don't have alpha? ---------------------------------------------------------------------- CorBee · 2014-11-19 22:02 Unfortunately I cant access the part where the FPreadPNG gets the info on the format. That info is not accessible during the loading in Lazarus. ---------------------------------------------------------------------- CorBee · 2014-11-21 14:31 Ive switched to the Vampyre Imaging Library ... turns out that the file was Gray16 without alpha. regards Cor ---------------------------------------------------------------------- Timewarp · 2014-11-22 11:04 Can you attach sample png? ---------------------------------------------------------------------- CorBee · 2014-11-22 11:06 The images are 3Mb in size, does the forum allow that ? ---------------------------------------------------------------------- circular · 2014-11-22 12:44 You can put a link to Dropbox, GoogleDoc... ---------------------------------------------------------------------- CorBee · 2014-11-22 13:45 Try this https://www.wetransfer.com/downloads/f9f99e5cdf9197bf23475a8fc7c152a62 0141122134233/1e0194152a26ae3aeef98d95232f05e320141122134233/cd666b or http://we.tl/sifb0a2dU3 ---------------------------------------------------------------------- marcov · 2014-11-22 13:46 Quote from: Timewarp on November 19, 2014, 10:03:25 pmQuote from: CorBee on November 19, 2014, 09:40:58 pmSo an unresolved issue ..And expected to remain (unless someone commits the patch) BGRABitmap has this fix included. It has been waiting for sb to do a thorough investigation for some time now. ---------------------------------------------------------------------- circular · 2014-11-22 14:24 The image seems to load well with BGRABitmap. It is 16-bit grayscale without alpha. ---------------------------------------------------------------------- CorBee · 2014-11-22 14:32 Good to hear that, I am using the Vampyre library currently. It would be nice to have a library that can read all the 16bit formats