W3C home > Mailing lists > Public > www-svg@w3.org > April 2007

Calculating Areas of Certain Colours

From: Matthew Tylee Atkinson <M.T.Atkinson@lboro.ac.uk>
Date: Fri, 06 Apr 2007 17:06:22 +0100
Message-ID: <46166FFE.7030103@lboro.ac.uk>
To: www-svg@w3.org

I'm not sure if this is the right place to ask this question; apologies 
if I've got the wrong idea!

I'm doing some work on modelling how users interact with certain types 
of GUI and am thinking of storing some of the measurements taken as SVG 
files so that they can be easily viewed to understand the results and 
converted to other formats.  The type of measurement being done is to 
see which areas of the screen the user visits.  Popular areas are white, 
unvisited areas black and sometimes-visited areas various shades of grey.

I would like to be able to calculate a summary value representing the 
area of the screen visited for each SVG file.  Is there a way to 
determine the (percentage) area of an SVG image occupied by a certain 
colour, or range of colours, without rasterising the image?

The SVG images will use only simple primitives such as circles (possibly 
with radial gradient fills) to store the results; we're not wanting to 
be pixel-perfect (in fact the resolution independence provided by SVG is 
one thing that attracted me to it).

Perhaps there is a library you can recommend (preferably with bindings 
to a scripting language such as Python, Ruby or Perl) that can load an 
SVG file, possibly rasterising it in the process, and have such 
questions asked of it.

I searched the list archives but found no leads, though I'm quite new to 
SVG and may have missed something, in which case I'd appreciate being 
pointed towards the answer :-).

Thanks in advance for your time,

best regards,


-- 
Matthew Tylee Atkinson <M.T.Atkinson@lboro.ac.uk>
Received on Friday, 6 April 2007 20:43:34 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:36 GMT