vector - How can I extract color values from an EPS file? -


i'm trying find fill , stroke values used in eps file. can parse file, can't figure out how color values defined in eps postscript section. have converted file svg (using ghostscript) , can hex values, eps svg conversion gradient produces files 20x size. there standard format color values in postscript can extract eps file?

postscript programming language, not simple file format, there no simple way determine going on in program.

a gradient may defined smooth shading in postscript, high level construct no equivalent in svg, rendered image (hence explosion in size).

you can use fact postscript programming language redefining basic operations, , using information want. example, find colour being used stroke might :

/originalstroke /stroke load def /stroke { (current colour space = ) print currentcolorspace == flush (current colour = ) print mark currentcolor counttomark -1 1 { -1 roll 20 string cvs print ( ) print} flush pop originalstroke } bind def 

of course need prepared cope rich variety of possible colour spaces in postscript; gray, rgb, cmyk, separation, devicen, ciebaseda, ciebasedabc, ciebaseddef, ciebaseddefg, indexed , pattern.

possibly don';t need know original values, i'm guessing true because conversion svg will, think, convert colours rgb, perhaps want rgb equivalents. in case use:

(current colour in rgb = ) print currentrgbcolor 3 -1 roll == exch == == flush 

i don't know how wold handle fill pattern colour though :-)

perhaps if explained why want know easier help.


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -