I'm currently extracting the colors of an .eps file via a .ps program. I'm trying to figure out how much each color is being used in the .eps file. Is it possible to get the area, or some measurement of the fill shape so I know how much the color is used overall in the .eps file?
My current solution is to rasterize the image and parse the histogram, but I'm trying to do this with the vector file.
To start investigating this, here's a replacement for fill
which will dump the path contents to stdout.
/={=only( )print}def
/oldfill /fill load def
/fill {
gsave
clip
clippath
{ exch = = (moveto\n)print }
{ exch = = (lineto\n)print }
{ 6 -1 1 { -1 roll = } for (curveto\n)print }
{ (closepath\n)print }
pathforall
grestore
oldfill
} def