Friday, November 11, 2011

EPS-ify Images with ImageMagick

I first talked about ImageMagick some time back here, but I think it is cool to talk about it once more.

So I'm currently using LaTeX as a means of keeping an electronic research journal. I like using LaTeX because of two advantages:
  1. Everything is text, so I can make use of a version control system to track changes.
  2. I have the full expression of equations and the what-not in the same manner as I would use to write actual papers, thus saving time.
(I might release the set of tools I've written to do this later.) But anyway, in spite of the great system I've worked out, there's this problem of including things like scanned drawings that I just don't want to spend time to vectorise using Inkscape (another great tool) only because it is only a rough drawing. LaTeX uses EPS files for graphics, and scanned stuff are usually not that. So what can we do?

Enter ImageMagick. Assume for the sake of demonstration our scanned file is image.png. Then the following commands will convert it to a [relatively small] EPS file:
  1. convert -quality 75 image.png image.jpg
  2. convert image.jpg eps3:image.eps
That's it. No need to have the GIMP or even Adobe Photoshop installed to do the conversion. The best part is, this set of commands achieves a nice compression for the final EPS file, which is great since a normal non-PS-level-3 image file is quite big.

That's enough technical talk for now.

No comments: