From: <jb...@ac...> - 2011-05-18 14:12:53
|
How do I display a palette based (indexed) PNG with gamma correction? I'm trying to read a PNG indexed (color type 3) image to which I've added a gamma transform (i.e. I've specified gamma values to png_set_gamma that will cause the RGB values in the palette to change.) In my code I use the sequential reader and I call png_read_update_info. The documentation (libpng-manual.txt - this is 1.5) says that the update call will update the palette according to the transformations (as well as updating other chunks that, as previously reported on the implementation list, don't actually get updated.) When I look at the palette (png_get_PLTE) it is unchanged (I think). When I look at png_read_update_info it doesn't change the palette - instead this happens later in png_init_read_transformations. However, even if I wait until after I've read all the rows of the image I still get the old palette back because I simply can't find a way to read the transformed one (in png_struct). I've checked back to 1.0.53 and the libpng code all looks the same. In particular there is only one call to png_set_PLTE in there and it happens when reading the PNG file. I think I must be doing something stupid; after all it must be possible to display palette based PNGs with gamma correction (without expanding to 24 bits), but how? John Bowler <jb...@ac...> |