logo       

Colour value differences between generated reference images and those in th: msg#00001

Subject: 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@xxxxxxxxxx  ▪  ICQ 26955922  ▪  MSN cam@xxxxxxxxx


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
boot-loaders.gr...    php.pear.genera...    debugging.valgr...    kde.redhat.user...    text.xml.xsl.ge...    culture.languag...    hardware.microc...    java.servicemix...    redhat.release....    web.zope.plone....    user-groups.lin...    opendarwin.webk...    video.mjpeg.use...    sysutils.bcfg2....    encryption.gpg....    lx-office.devel...    xfree86.forum/2...    mail.mutt.devel...    acpi.devel/2003...    qnx.openqnx.dev...    network.irc.irs...    freebsd.devel.m...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe