I'm trying to find all fill and stroke values used in an EPS file. I can parse the file, I just can't figure out how color values are defined in the EPS postscript section. I have converted the file to SVG (using ghostscript) and I can get the hex values, but an EPS to SVG conversion with a gradient produces files 20x the size. Is there a standard format for color values in postscript that I can extract from an EPS file?
相关问题
- Set *both* elements and initial capacity of std::v
- Is it more efficient to set the size of a vector u
- Efficiently chunk large vector into a vector of ve
- How to create 2D arrays in Python
- What is the nicest way to find a specific string i
相关文章
- How do I get characters common to two vectors in C
- How can I unpack (destructure) elements from a vec
-
C++, how to correctly copy std::vector
in c - How to calculate end points of perpendicular line
- add to vector without copying struct data
- Finding the indexes of all occurrences of an eleme
- VectorDrawable image becomes pixelated
- Prettier syntax for “pointer to last element”, std
PostScript is a programming language, not a simple file format, so there is no simple way to determine what is going on in the program.
A gradient may well be defined as a smooth shading in PostScript, which is a high level construct with no equivalent in SVG, so it will be rendered as an image (hence the explosion in size).
You can use the fact that PostScript is a programming language by redefining the basic operations, and using that to get the information you want. For example, to find the colour being used for a stroke you might do :
Of course you will need to be prepared to cope with the rich variety of possible colour spaces in PostScript; Gray, RGB, CMYK, Separation, DeviceN, CIEBasedA, CIEBasedABC, CIEBasedDEF, CIEBasedDEFG, Indexed and Pattern.
Possibly you don';t need to know the original values, I'm guessing this is true because conversion to SVG will, I think, convert all colours to RGB, so perhaps you only want the RGB equivalents. In which case you could simply use:
I don't know how you wold handle a fill with a Pattern colour though :-)
Perhaps if you explained why you want to know this it would be easier to help.
the size of the bit image should not really matter if all you do is get a histogram and throw it away:
I assume everyone has netpbm...netpbm.sourceforge.net