Compressing EPS files with ImageMagick

Sometimes I find I have a .eps file that is taking up 20 Mb of space despite being only 200x200 or something. Here’s a command to enable compression:

$ convert $INFILE -compress lzw eps2:$OUTFILE

I believe that’s lossless compression. In a recent case, that took an image from 1.6 Mb to about 200 kb, which is usually more than enough. To compress even more, you can use -resize:

$ convert $INFILE -compress lzw -resize 50% eps2:$OUTFILE

EDIT: This works great on rasterized images; for vector graphics, this will rasterize everything, which may not be what we’re looking for.