You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Cameron McCormack <ca...@mcc.id.au> on 2007/10/03 03:15:32 UTC
Colour value differences between generated reference images and those in the repository
Hi Thomas.
I’ve been looking in to why the reference images in the repository often
are different from the images that are generated when I run regard. The
main difference seems to be when non-opaque colours are composited.
As an example, I took a look at the second row fourth column sub-test of
samples/tests/spec/rendering/paintOpacity.svg, specifically one of the
pixels that is the 0.5 opacity gold painted on the opaque #eee
background square.
The reference image in the repository is
http://svn.apache.org/repos/asf/xmlgraphics/batik/trunk/test-references/samples/tests/spec/rendering/paintOpacity.png
and the image generated on my machine is
http://mcc.id.au/temp/2007/paintOpacity.png. The PNGs themselves are
identical except for the IDAT chunk.
In the repository reference image, the pixel value is
rgba(224, 222, 118, 255), while in my image it is
rgba(246, 226, 119, 255).
Taking the alpha compositing rules from
http://www.w3.org/TR/SVG11/masking.html#SimpleAlphaBlending, this is my
calculation of the pixel value:
// Premultiplied #eee background
Ca = 1
Cr = 238
Cg = 238
Cb = 238
// Premultiplied 0.5 opacity gold rgb(255,215,0)
Ea = trunc(trunc(0.5 * 255) / 255) = 0.49804
Er = trunc(Ea * 255) = 127
Eg = trunc(Ea * 215) = 107
Eb = trunc(Ea * 0) = 0
// Premultiplied final pixel value
Ca' = trunc(1 - (1 - Ea) * (1 - Ca))
= trunc(1 - 0.50196 * 0)
= 1
Cr' = trunc((1 - Ea) * Cr + Er)
= trunc(0.50196 * 238 + 127)
= 246
Cg' = trunc((1 - Ea) * Cg + Eg)
= trunc(0.50196 * 238 + 107)
= 226
Cb' = trunc((1 - Ea) * Cb + Eb)
= trunc(0.50196 * 238 + 0)
= 119
and un-premultiplied this is the same as rgb(246, 226, 119, 255), which
matches the value in my image. So my question is: are the reference
images in the repository wrong? I’m not an expert on colour, so I don’t
know if there are other factors (colour spaces that the compositing
could occur in, for example) that would allow the values in the
repository reference image. Any ideas?
Thanks,
Cameron
--
Cameron McCormack, http://mcc.id.au/
xmpp:heycam@jabber.org ▪ ICQ 26955922 ▪ MSN cam@mcc.id.au
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org
Re: Colour value differences between generated reference images and those in the repository
Posted by Cameron McCormack <ca...@mcc.id.au>.
Cameron McCormack:
> // Premultiplied 0.5 opacity gold rgb(255,215,0)
>
> Ea = trunc(trunc(0.5 * 255) / 255) = 0.49804
One too many trunc()s in there, should be:
Ea = trunc(0.5 * 255) / 255 = 0.49804
--
Cameron McCormack, http://mcc.id.au/
xmpp:heycam@jabber.org ▪ ICQ 26955922 ▪ MSN cam@mcc.id.au
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org
Re: Colour value differences between generated reference images and those in the repository
Posted by Cameron McCormack <ca...@mcc.id.au>.
Cameron McCormack:
> > As an example, I took a look at the second row fourth column sub-test of
> > samples/tests/spec/rendering/paintOpacity.svg, specifically one of the
> > pixels that is the 0.5 opacity gold painted on the opaque #eee
> > background square.
>
> > In the repository reference image, the pixel value is
> > rgba(224, 222, 118, 255), while in my image it is
> > rgba(246, 226, 119, 255).
Thomas DeWeese:
> Hmm, on my machine, using gimp, the reference image
> shows the pixel value as rgba(246, 225, 118, 255),
> and your generated one has rgba(247, 227, 119, 255).
> I can easily imagine reasons why the two would vary by
> a code value (or two).
>
> How are you checking the reference/output Image's pixel values?
I am using gimp, too (2.4.0-rc3). I turned the colour management mode
to “No color management” in the preferences window just to be sure it
wasn’t doing anything, but get the same values.
--
Cameron McCormack, http://mcc.id.au/
xmpp:heycam@jabber.org ▪ ICQ 26955922 ▪ MSN cam@mcc.id.au
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org
Re: Colour value differences between generated reference images and those
in the repository
Posted by th...@kodak.com.
Hi Cameron,
Cameron McCormack <ca...@mcc.id.au> wrote on 10/02/2007 09:15:32 PM:
> As an example, I took a look at the second row fourth column sub-test of
> samples/tests/spec/rendering/paintOpacity.svg, specifically one of the
> pixels that is the 0.5 opacity gold painted on the opaque #eee
> background square.
> In the repository reference image, the pixel value is
> rgba(224, 222, 118, 255), while in my image it is
> rgba(246, 226, 119, 255).
Hmm, on my machine, using gimp, the reference image
shows the pixel value as rgba(246, 225, 118, 255),
and your generated one has rgba(247, 227, 119, 255).
I can easily imagine reasons why the two would vary by
a code value (or two).
How are you checking the reference/output Image's pixel values?