DataBuffer, ColorModels and SampleModels

LOUD, Ben Ben.LOUD at
Tue May 15 00:20:10 UTC 2007

Ah, I just read the ICC_ColorSpace JavaDocs more closely (always helps),
and of course, they say that toRGB uses a perceptual conversion (which
is good). The Classpath converters just do a trivial relative
colorimetric conversions (which are defined in the w3c spec) where the
results are very accurate provided the colors are within gamut. Any out
of gamut colors just get clipped (bad, information is lost). 

Libraries like Kodak are a bit more intelligent and compress the gamut,
so out of gamut colors can still be converted with some level of
accuracy, but it means there'll be slight innaccuracies for in gamut
colors (though the overall perceptual quality is improved). The down
side is there's no "correct" way to do this, the results will be
different with each CMM. 

With that in mind, I don't think the Classpath code is suitable

-----Original Message-----
From: 2d-dev-bounces at
[mailto:2d-dev-bounces at] On Behalf Of Roman Kennke
Sent: Monday, 14 May 2007 9:46 PM
To: Jeannette.Hung at
Cc: 2d-dev; Phil Race; Dmitri Trembovetski; Alexey Ushakov
Subject: Re: DataBuffer, ColorModels and SampleModels


> Wow...  That's a huge difference.  Did you compare the pixel values 
> between your build, the openjdk build, and the production JRE build?

I did so just now. I bombed the standard jdk6 build with 1000000 random
values and stored the conversion results in a file. Another program
reads in those values and compares it with the same conversion on the
current VM's build. Here are the results:

plain OpenJDK:
average difference from reference: 0.00380017
maximum difference from reference: 0.038417127

OpenJDK with Classpath CMS:
average difference from reference: 0.00280433
maximum difference from reference: 0.0042832294

>   I 
> know the color code isn't straightforward for conversion between a
> and a sRGB color space since I think the gray space is linear and the 
> sRGB one is not.

Yeah right. And apparently the code needs more testing for other
conversions than gray->rgb.



More information about the 2d-dev mailing list