Recent

Author Topic: FPReaderPNG doesnt read 16bit Gray (single channel) PNG files  (Read 7805 times)

CorBee

  • New Member
  • *
  • Posts: 32
FPReaderPNG doesnt read 16bit Gray (single channel) PNG files
« on: November 19, 2014, 09:02:33 pm »
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
*************************************************
« Last Edit: November 19, 2014, 09:06:42 pm by CorBee »

Timewarp

  • Full Member
  • ***
  • Posts: 144

CorBee

  • New Member
  • *
  • Posts: 32
Re: FPReaderPNG doesnt read 16bit Gray (single channel) PNG files
« Reply #2 on: November 19, 2014, 09:40:58 pm »
Thanks. So an unresolved issue ..

Timewarp

  • Full Member
  • ***
  • Posts: 144
Re: FPReaderPNG doesnt read 16bit Gray (single channel) PNG files
« Reply #3 on: November 19, 2014, 10:03:25 pm »
So an unresolved issue ..
And expected to remain (unless someone commits the patch)

BGRABitmap has this fix included.

CorBee

  • New Member
  • *
  • Posts: 32
Re: FPReaderPNG doesnt read 16bit Gray (single channel) PNG files
« Reply #4 on: November 19, 2014, 10:29:17 pm »
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

  • Full Member
  • ***
  • Posts: 144
Re: FPReaderPNG doesnt read 16bit Gray (single channel) PNG files
« Reply #5 on: November 19, 2014, 10:52:16 pm »
Problem is in ColorGrayAlpha16
Are you sure your images don't have alpha?
 

CorBee

  • New Member
  • *
  • Posts: 32
Re: FPReaderPNG doesnt read 16bit Gray (single channel) PNG files
« Reply #6 on: November 19, 2014, 11:02:34 pm »
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

  • New Member
  • *
  • Posts: 32
Re: FPReaderPNG doesnt read 16bit Gray (single channel) PNG files
« Reply #7 on: November 21, 2014, 03:31:46 pm »
Ive switched to the Vampyre Imaging Library ... turns out that the file was Gray16 without alpha.

regards
Cor

Timewarp

  • Full Member
  • ***
  • Posts: 144
Re: FPReaderPNG doesnt read 16bit Gray (single channel) PNG files
« Reply #8 on: November 22, 2014, 12:04:50 pm »
Can you attach sample png?

CorBee

  • New Member
  • *
  • Posts: 32
Re: FPReaderPNG doesnt read 16bit Gray (single channel) PNG files
« Reply #9 on: November 22, 2014, 12:06:10 pm »
The images are 3Mb in size, does the forum allow that ?

circular

  • Hero Member
  • *****
  • Posts: 4220
    • Personal webpage
Re: FPReaderPNG doesnt read 16bit Gray (single channel) PNG files
« Reply #10 on: November 22, 2014, 01:44:01 pm »
You can put a link to Dropbox, GoogleDoc...
Conscience is the debugger of the mind


marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11453
  • FPC developer.
Re: FPReaderPNG doesnt read 16bit Gray (single channel) PNG files
« Reply #12 on: November 22, 2014, 02:46:27 pm »
So 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

  • Hero Member
  • *****
  • Posts: 4220
    • Personal webpage
Re: FPReaderPNG doesnt read 16bit Gray (single channel) PNG files
« Reply #13 on: November 22, 2014, 03:24:19 pm »
The image seems to load well with BGRABitmap. It is 16-bit grayscale without alpha.
Conscience is the debugger of the mind

CorBee

  • New Member
  • *
  • Posts: 32
Re: FPReaderPNG doesnt read 16bit Gray (single channel) PNG files
« Reply #14 on: November 22, 2014, 03:32:12 pm »
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

 

TinyPortal © 2005-2018