p237RGB by Vid the Kid
The goals of this new color space, in decreasing order of importance, are as
- Map from XYZ to new color space preserves collinearity.
- Transfer function relating new color space gray values to actual
brightness resembles that relating sRGB gray values to actual brightness.
- Gamut is reasonable.
- New color space has some semblance of perceptual uniformity. (As this
property is expected to emerge from the others, little additional effort was
made towards this goal.)
In order to meet both of the first two goals, the transformation between
spaces would have to involve a perspective transformation between intermediate
spaces. In the development of the color space, there were some degrees of
freedom in the choice of mapping between an intermediate color space and the
final RGB color space. There was a choice that would enclose sRGB's entire
nominal range in the new color space's nominal range, matching its secondary
colors, but also consisted of a high proportion of imaginary colors. There
was a choice which would put the new color space's nominal range entirely inside
of sRGB's nominal range, matching its primary colors, but leaving many common
bright colors outside of the new space's nominal range. A family of
compromises were considered, with three degrees of freedom. The chosen
compromise was parametrized as (2⁄8,3⁄8,7⁄8).
Given the use of a perspective transform, and to distinguish it from potential
alternate choices, the color space is named p237RGB.
Transformation between XYZ and p237RGB is performed in three steps
XYZ to RGB
RGB to XYZ
where XW and
ZW are the X
Z coordinates of the reference white point
(illuminant D65 with Y = 1). XYZ coordinates
Considering only chromaticity, the gamut of p237RGB is
considerably larger than that of sRGB, illustrated in the above graphic.
The extents are somewhere between those of Adobe RGB and Wide Gamut RGB, also by
Adobe. Some imaginary chromaticities fall within p237RGB's
gamut, near the red and blue primary axes. With nearly all RGB color spaces, the
gamut over chromaticities is caused by the requirement that color components are
represented with nonnegative numbers. If negative values are allowed for
one or more channels, and the meaning of negative values well-defined, then any
chromaticity becomes possible.
Considering an upper limit on RGB values — specifically, that an RGB value in
any channel for a “normal” color is not greater than the value in the same
channel for the reference white — the gamut of p237RGB actually falls
a bit short of covering the entire sRGB gamut. The “brightest” colors
representable in sRGB are not representable in p237RGB if RGB values
are limited to the nominal range [0…1]. The graphic below illustrates the cuboid
region which is common to the nominal gamut of both sRGB and p237RGB.
The coordinates given are in p237RGB and can hint at what deeper
colors are representable in p237RGB but cannot be displayed on a
typical computer screen.
It is the author's opinion that the “bright” colors possible in sRGB which
would require greater-than-one values in p237RGB aren't typically
reproducible by typical consumer printers. Therefore, if content is to
eventually be printed, it may be advisable to stay within p237RGB's
slightly reduced range at the content creation stage.
If RGB values greater than one are allowed, p237RGB can easily
represent the brighter colors of sRGB's nominal gamut. Furthermore,
because of the perspective transform, the gamut of p237RGB actually
extends to colors of infinite luminosity with finite RGB values.
Color Mixing & Gradients
The primary requirement in the development of this color space is that
collinearity is preserved in conversion to and from CIE XYZ. A physical mix of
two light sources of different colors will lie on a line in the XYZ color space;
the same property was desired for the new color space, so therefore preservation
of collinearity was made a priority. As a result, linear numerical
interpolations between two colors in p237RGB represent linear
physical combinations of physical light sources in those two colors. This
feature is not true of RGB color systems that utilize nonlinear transfer
functions independently for each channel, as most do.
Preservation of collinearity ensures that colors in a p237RGB
linear gradient are accurate interpolations between the endpoint colors.
As a (wanted) side-effect of the desired grayscale transfer curve, linear
gradients in p237RGB usually do not, however, have a pace that is
linear in CIE XYZ space. Instead, the colors in a gradient change at a
fairly uniform pace in human perception. Noticeable exceptions occur when
one endpoint of the gradient is black, as the color seems to change a bit more
rapidly towards the black end; still, this is less noticeable than it would be
if the gradient were interpolated in CIE XYZ. Additionally, in most
nonlinear RGB color spaces, if a gradient changes primarily in one channel whose
value is zero at one end but the color is not black, that end will have almost
no perceptible color change near that end; this phenomenon does not occur in p237RGB.
Colors in p237RGB can easily be converted to grayscale without
converting to other color spaces. In the intermediate stages of
transformation between XYZ and RGB, the w parameter
depends only on the Y (luminance) value in XYZ.
In the next stage, w' depends only on
w. w' can be
calculated from p237RGB as a weighted sum of the RGB components and a
bias term, though its scale isn't convenient as a general luminance measurement.
Instead, we can use a new parameter, linearly related to
w': w* = .2473R
+ .7079G + .0448B.
If a color is modified so its R,
G, and B values are
replaced by their w* weighted average, the
resulting color is a pure gray with the same luminance (CIE
Y value) as the original color.
p237RGB comes relatively close to being perceptually uniform,
compared to other RGB color spaces. Euclidean distance between colors in p237RGB
may be a better predictor of perceived color difference than in other RGB
spaces. However, such a metric would tend to underestimate perceived
difference between colors of different chroma, and overestimate that between
colors of different luminance. Perhaps an even better metric is Euclidean
distance in the intermediate u'v'w' space described
above. An alternative final transformation (which would result in pmpRGB)
was considered which put perceptual uniformity above gamut in importance, but
this was abandoned when it became apparent that a unity-clamped RGB space in
such an arrangement would exclude colors with high or even moderate saturation.
For the purposes of measuring color difference, however, p237RGB can
be transformed via a simple matrix into pmpRGB, in which Euclidean
distance should be a fairly good predictor of perceived color difference.
When completed, an ICC color profile for p237RGB will be made
available to download.
This document is copyright ©2011 Vid the Kid. However, I want people to
be able to use p237RGB, so the formulas are freely licensed for any
use, with the condition that any modification is given a different color space
name. The ICC profile downloadable file is also copyrighted, and also
freely licensed for any use, with the condition that any modified version is
given a different color space name. All graphics in this document are
hereby released into the public domain.