pngread does not read 12bit gray images

Bengt-Arne Fjellner baf at ltu.se
Thu Jul 10 12:23:30 CDT 2008




On 2008-07-05 7:41 PM, "de Almeida, Valmor F." <dealmeidav at ornl.gov> wrote:

> 
> Hello,
> 
> I am using imread() to read 12-bit png images. The result of
> 
> Y = imread("foo.png");
> class(I);
> 
> is uint16. However the max and min values of Y are not correct. I
> tracked the problem down to this section of pngread.cc in the
> octave-forge package image-1.06
> 
>   // For now, use 8-bit only
>   if (bit_depth == 16) {
>       png_set_strip_16(png_ptr);
>   }
> 
> Is there a simple fix for this so that I do get all gray values into the
> matrix Y? The issue here is that after the 8-bit strip, the image loses
> critical information; in particular contrast details that are important
> for the image processing code I am writing.
> 
> Thanks,
> 
> --
> Valmor
I'm working on one to:
Download and try:
http://pinus.tt.ltu.se/~baf/pngread.cc
The test for endianness of the machine should be done during compilation but
I haven't figured out how.

And if it seems to work just include it in the distro.







More information about the Help-octave mailing list