views:

10150

answers:

9

What is the best way to convert a eps image to a png?

Edit: The original question asked to preserve vector information, but it was pointed out that png is a raster format. The revised question therefore no longer asks for preservation of vector information.

+4  A: 

PNG is a raster format, meaning it won't preserve vector information.

Alexander
+9  A: 

If you have the ImageMagick package installed, you can use the convert(1) program:

convert image.eps image.png
lindelof
Note that in some cases you'll need a colour profile so it doesn't come out wonky.
ceejayoz
+1  A: 

Try SVG instead.

Problem: Internet Explorer supports it using a discontinued Adobe plugin. Other mainstream browsers have native support.

artur02
+2  A: 

EPS files are hard to convert on your own because they're programs written in the postscript-language. To rasterize them on your own you don't only need a postscript interpreter but a full blown rasterizer-library as well.

The GNU Ghostscript package can do all that and even more for you. It can load and render these files from a command line and write them to bitmap files. It lets you choose the resolution, the color-depth and different anti-aliasing settings.

The package is easy to find on google and- there is a windows port of it as well.

To convert EPS files from a program or command line you don't need the GSview GUI-frontend btw.

Nils Pipenbrinck
+5  A: 

If you want an easy user friendly way to do it without needing to know ninja-commands, GIMP ( Gnu Image Manipulation Program ) comes with ability to load eps files. I've in fact also found it the most reliable tool to do so, especially with the larger ones, some applications just die.

GIMP also comes with ability to set anti aliasing settings and you can specify the arbitrary scale you want to render the image at.

EDIT: GIMP uses GhostScript ( @Nils ) as the backend for rasterising. It just nicely abstracts the interface for you for the sake of user friendlyness. However, setting this up on windows is a little harder, ( it JustWorks(TM) on linux )

  • I can't open PS and EPS files. Am I missing something?
    • You need to install GhostScript to be able to read PostScript files with GIMP. GhostScript can be downloaded from http://pages.cs.wisc.edu/~ghost/. After you install GhostScript, set the environment variable GS_PROG to the full path to gs.exe.
Kent Fredric
A: 

You should probably specify what environment you're working in.

On the Mac, as a user, double click and it will open in Preview as a PDF. Save as, and select PNG from the popup. Or, leave it as a PDF, it's a better match than png anyway.

Programmatically, on the mac, it's more or less the same process. You use CGPSConverter to convert the EPS to PDF data, draw it in a bitmap, and save it as a png. Bindings for the required functions are available in C and python in the standard OS install.

Ken
A: 

inkscape

file -> export bitmap

Ronny
A: 

Another way on Linux is the program potrace it converts vector graphics in bitmaps and vice versa. I often use it when ImageMagick wasn't able to convert an .eps file.

unexist
A: 

If you want to do it programmatically, or you don't shy back from writing your own converter, the Cairo library is a easy way to do such a conversion. Using the python bindings for cairo it is only a matter of a few lines to implement it yourself. In java I think it would be possible to use batik with similar success.

Mauli