Posts tagged ‘eps’

Convert EPS files to PNG images

Doxygen generates collaboration diagrams in EPS format. If you want to include these graphics in a Latex document that produces PDF output, you have to convert them, for example, to PNG format. To make the conversion we’re going to use Convert. Convert provides image conversion between different formats and belongs to the ImageMagick suite of tools. Just navigate to the directory containing the EPS files and type this command:

for var in `ls|grep eps`;do convert $var ${var}.png;done

This produces PNG images with an .eps.png extension. If you want to leave just the png extension run this python script:

1
2
3
4
#!/usr/bin/python
import os
for fname in os.listdir(os.getcwd()):
        os.rename(fname, fname.replace('.eps.png','.png'))