Convert JPEG to EPS, retaining compression


Despite JPEG being a nearly ubiquitous image format, it is often necessary to convert JPEG files to encapsulated PostScript (EPS) for inclusion in other documents (eg LaTeX). Unfortunately converting JPEG to EPS typically produces much larger files, since the compressed JPEG data is usually decompressed before being written to the EPS file. Since JPEG compression saves about 90% of the space, you typically get EPS files that are over ten times larger than the original JPEG (actually it’s more like 20 times, since the uncompressed binary data is usually written as hexadecimal ASCII text).

It turns out there is actually no need to decompress, since PostScript level 2 and higher can decompress JPEG internally - thus it is possible to “wrap” the compressed JPEG data in some PostScript to make a valid EPS file which is only about 25% bigger than the original JPEG.

This can be done with the utility jpeg2ps, which is available on several platforms.

Alternatively, if you have GhostScript installed on your machine you may prefer the utility jpeg2eps supplied here. This does much the same thing but is written in PostScript, so it can be run on any platform that supports GhostScript. The output EPS is standards-compliant so it should work fine just about anywhere.


Nota completa http://rses.anu.edu.au/~andy/jpeg2eps/

Comentarios