From 7e2d7a4fe94dd8ba04a9a1d7868fddc6d8c0bfc7 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Fri, 5 Jul 2013 17:46:58 +0000 Subject: miscellaneous update git-svn-id: http://svn.code.sf.net/p/netpbm/code/userguide@1975 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- pngtopam.html | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) (limited to 'pngtopam.html') diff --git a/pngtopam.html b/pngtopam.html index 09406ef4..11f330c6 100644 --- a/pngtopam.html +++ b/pngtopam.html @@ -131,12 +131,33 @@ caused a usability problem).
-gamma=value -
Converts the image to a new display-gamma value. If a gAMA chunk -is present in the png-file, pngtopam uses the specified -image-gamma value. If not, pngtopam considers the image-gamma -to be 1.0. Based on the image-gamma and the display-gamma given with -this option, pngtopam adjusts the colors written to the -pnm-file. +
This option causes pngtopam to respect the image gamma information +in the PNG file (from the gAMA chunk). Probably by historical accident, +pngtopam ignores that information by default, assuming the image uses +the same gamma transformation as a Netpbm image, so the output image has +different colors than the PNG file actually represents if the PNG doesn't +actually do that. (However, it is rare for a PNG file to use a gamma +transformation different from what the Netpbm formats specify, or if it does, +to specify with a gAMA chuck what that is). + +

But when you do specify -gamma, you get a rather strange +additional function, probably a historical mistake: +pngtopam incorporates the specified screen gamma value into the output +pixels, so that the samples in the Netpbm output deviate from the Netpbm +format specifications and are appropriate raw intensity values to send to the +display. This function essentially just exercises the ability of the PNG +library to make gamma corrections to the pixels as it reads them from the PNG +file to produce values appropriate for sending to a certain display in certain +viewing conditions. It's a strange function because it has nothing to do with +PNG and because in Netpbm, the normal way to make gamma corrections +appropriate for sending to a ceratin display in certain viewing conditions is +with the program pngtopam, applied to the normal output of +pngtopam. + +

If you specify -gamma, but the PNG image does not specify what gamma +transformation it uses (there is no gAMA chunk), pngtopam assumes a +simple power transformation with an image gamma of 1.0. That is probably not +not the actual image gamma; it is much more likely to be .45.

Because the gammas of uncompensated monitors are around 2.6, which results in an image-gamma of 0.45, some typical situations are: @@ -152,13 +173,10 @@ transparent. But pngtopam interprets this as applying to the gamma-corrected space, and there may be less precision in that space than in the original, which means multiple uncorrected colors map to the same corrected color. So imagine that the image contains 3 shades -of white and specifies that one of them is transparent. After gamma +of white (gray) and specifies that one of them is transparent. After gamma correction, those three shades are indistinguishable, so pngtopam considers pixels of all three shades to be transparent. -

If this is not what you want, don't use gamma. Instead, -use pnmgamma on the output. -

-text=file -- cgit 1.4.1