[IPOL discuss] libpng

Julien Rabin rabin.julien at gmail.com
Mon Jul 25 20:44:30 CEST 2011


Hello everyone,

I think there may have a bug in the 'io_png.c' file provided on IPOL.

We wanted with Édouard to use the function 'read_png_u8_gray' but we found
out that there is a problem when computing the intensity of a color image.
Indeed, the code on lines 330--333 :

while (ptr_gray < ptr_end)
>             *ptr_gray++ = (unsigned char) (6969 * *ptr_r++
>                                            + 23434 * *ptr_g++
>                                            + 2365 * *ptr_b++) / 32768;
>

should be

while (ptr_gray < ptr_end)
>             *ptr_gray++ = (unsigned char) ((6969.f * *ptr_r++
>                                            + 23434.f * *ptr_g++
>                                            + 2365.f * *ptr_b++) / 32768.f);
>

Best regards,

-- 
Julien Rabin
Post-Doctorant au CMLA <http://www.cmla.ens-cachan.fr/>, ENS de Cachan
tel. CMLA : 01-47-40-59-42
tel. portable : 06-87-39-58-26
web  : http://www.tsi.enst.fr/~rabin/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tools.ipol.im/mailman/archive/discuss/attachments/20110725/1805dfda/attachment.htm>


More information about the discuss mailing list