Canvas, color management and GetImageData

Section 4.8.11.2 "Color spaces and color correction" imho contains confusing language.

>From the spec: [with my annotations]
>The canvas APIs must perform color correction at only two points:
>[ConversionA] when rendering images with their own gamma correction and color space information [call this image-space] onto the canvas, to convert the image to the color space used by the canvas [call this canvas-space]
>[ConversionB] and when rendering the actual canvas bitmap to the output device. [call this display-space]

>Note: Thus, in the 2D context, colors used to draw shapes onto the canvas will exactly match colors obtained through the getImageData() method.

[image-space] is defined in the image file.
[canvas-space] (from my reading of the spec) is not clearly defined.
[display-space] is set by the OS; Windows automatically sets up the correct display profiles for a large number of displays. The space differs from machine to machine.

Now, if the image doesn't contain any color profile information, it seems that the raw pixel color values from the file are painted into the canvas, and onto the screen (in Safari 4.0.3, Firefox 3.5; this imho is correct behavior, as you don't introduce color shifts for web developers who don't care about color management.)

In the case where image-space is defined, the spec indicates that color correction should only be done at two points - when moving pixels from image-space to canvas-space, and from canvas-space to display-space. (ConversionA, ConversionB) OK.
 
When I call getImageData() on the canvas (in Safari 4.0.3, Firefox 3.5), I get RGBA values in display-space (in other words, already converted to the display profile)

So, based on the language in the spec, and the 2 current implementations of color-managed canvas, it seems that:
canvas-space = display-space?

ConversionA converts from image-space to canvas-space (aka display-space)
ConversionB converts from canvas-space to display-space (but as they are the same, no color values are actually changed)

Is the intent of the spec that canvas-space = display-space?

Thanks
Frank Olivier

Received on Thursday, 17 September 2009 07:40:42 UTC