tags:

views:

1351

answers:

3

We have a webapp where people can upload various image file types and on the backend we convert them to a standard type (typically png or jpeg). Right now we are using ImageIO to do this. However the new requirement is to be able to support eps files. I haven't found any libraries that support EPS in ImageIO, or much in the way of support for reading eps files in java.

Any suggestions for reading eps files and converting them?

A: 

EPS is PostScript files with preview, IIRC. So basically you need a PostScript interpreter in Java. I doubt you will find many...

Perhaps a better approach is to call GhostScript from Java. It is probably the best free/open source PostScript interpreter/renderer around, it would be hard to beat it.

PhiLho
+1  A: 

Freehep has a Java PostScript Viewer that you might be able to rework into a PS converter.

Rich Apodaca
+1  A: 

I'm pretty sure ImageMagick (a C library) can do that (though I believe it requires GhostScript), and there's a JNI wrapper for ImageMagick called JMagick that allows access to ImageMagick from Java. If you can deal with JNI, JMagick might do the trick.

Brian Clapper
What we ended up doing was calling the imagemagick command line tools directly instead of through JMagick. This appeared to be the easiest solution.
harmanjd