Fun with postscript
(You can suggest changes to this post.)
Had the joy of converting a CR delimited (rather than CRLF or LF) encapsulated postscript file with some weirdo proprietary colour-scheme into a flexible, compact, usable file.
A huge thumbs up goes to eps2eps (and it's sibling, ps2ps). What's that, you say? Utilities to convert postscript into postscript? Why, I can do that using cat, and I bet it runs faster.
Sure, it does run faster, but ps2ps has the advantage of stripping out huge amounts of cruft left by the creating program, and leaving a functionally equivalent, but much smaller and simpler file. How small and simple? It takes a 130k file and reduces it down to 10k. That makes it much easier for the next step, which is to open it up in vim and hack the postscript directly.
No, it's not that bad, really. You grab the image in gimp and using the colour-grabbing tool to find what ghastly shades things have been translated to, and then look up a "good copy" (rendered png or some such) to see what the colours are supposed to be. Search and replace on these RGB triplets, and viola, it looks fantastic, loads into all your favourite tools and programs, and doesn't require Adobe Illustrator with Pantone extensions, or whatever bothersome thing was used to create the original.
Actually, not everything is an RGB triplet. Sometimes there are just Red/Non-Red duplets (don't ask me why), but provided that you understand that postscript is a stack-based language (where function calls come after their arguments), then it's all okay. If you don't realise it's stack based, well, you're probably screwed from the beginning.
3 Myths That Block Progress For The Poor
The belief that the world can’t solve extreme poverty and disease isn’t just mistaken. It is harmful. Read more...
This site is ad-free, and all text, style, and code may be re-used under
a Creative Commons Attribution 3.0 license.
If like what I do, please consider
supporting me on Patreon,
or donating via Bitcoin (1P9iGHMiQwRrnZuA6USp5PNSuJrEcH411f).