Proposed extension of PNG Color Tutorial to explain how to use cHRM draft 1.0.0 (2000-Mar-07-Tue) Adam M. Costello http://www.nicemice.net/amc/ This proposal would add factual information to the color tutorial in the PNG 1.2 spec, but would not add any recommendations. Section 14.7 (Characterizing computer monitors) currently ends with: Usually, the first thing a program will do is convert the cHRM chromaticities into relative XYZ space. I propose extending this section to tell how this can be done, because it's far from obvious: Usually, the first thing a program will do is convert the cHRM chromaticities into relative XYZ space, which can be done as follows. Denote the values from the cHRM chunk by xw, yw, xr, yr, xg, yg, xb, yb. The values zw, zr, zg, zb can be inferred from: z = Z / (X + Y + Z) = 1 - x - y Let m be a matrix containing the xyz coordinates of the three phosphors: xr xg xb m = yr yg yb zr zg zb A column vector W containing the relative XYZ coordinates of white can be calculated as: Xw Xr + Xg + Xb xw/yw W = Yw = Yr + Yg + Yb = yw/yw Zw Zr + Zg + Zb zw/yw A matrix M containing the relative XYZ coordinates of the three phosphors can be calculated as: Xr Xg Xb 1 M = Yr Yg Yb = m * ( 1 transpose(invert(m) W) ) Zr Zg Zb 1 Here * means simply multiply corresponding entries, not matrix multiplication. If you need only the Y values (for converting to greyscale), this simplifies to: Yr yr Yg = yg * (invert(m) W) Yb yb For convenience, here are the relative XYZ values corresponding to the CCIR 709 primaries and D65 white point (the same chromaticities used by sRGB): Xr = 0.412391 Xg = 0.357584 Xb = 0.180481 Yr = 0.212639 Yg = 0.715169 Yb = 0.072192 Zr = 0.019331 Zg = 0.119195 Zb = 0.950532 For consistency, I suggest rewording the end of section 14.9 (Converting between RGB and XYZ): old: R X G = invM Y B Z where invM is the inverse of the matrix M. new: R X G = invert(M) Y B Z End of proposal.