By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,092 Members | 1,650 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,092 IT Pros & Developers. It's quick & easy.

Vector EPS/PS from PHP & ImageMagick or GD

P: n/a
Hi all. I'm creating a web-based application that uses PHP, MySQL &
Apache on a Windows platform. What I need to do is create images on
the fly with either GD or ImageMagick, display them on the web browser
and then save the file.

The tricky part is the format of that saved file - it needs to be an
EPS format. The image won't be anything terribly exciting - just some
basic shapes (boxes, circles, etc) and some text. No fancy colors,
textures, or effects. It will be imported into a vector-based program
and processed there. That program can only import EPS files, other
than their own proprietary format.

Is this even possible without getting into hardcore programming? Does
ImageMagick or GD offer some kind of vector-based file format? Is
there something that I'm not seeing in the documentation? If this is
better accomplished using the libraries and programs in Linux, that is
certainly an option.

Any help would be greatly appreciated!

Thanks!

Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"shanergb" <sh***@sthoen.com> writes:

The tricky part is the format of that saved file - it needs to be an
EPS format. The image won't be anything terribly exciting - just some
basic shapes (boxes, circles, etc) and some text. No fancy colors,
textures, or effects. It will be imported into a vector-based program
and processed there. That program can only import EPS files, other
than their own proprietary format.
From what I know, you cannot generate EPS files in PHP. If EPS is
your requirement, I think you will have to use Imagemagick. Again
from what I know about Imagemagick, you cannot use it to output
circles, boxes etc. It is mostly used to work with images rather than
figures. You have these options

- Use PHP to generate you figure (there are functions to draw
lines/circles/rectangles), save the figure as TIFF and then use
imagemagick to convert from TIFF to eps (using imagemagick's' convert
utility)

- Use pdflib to generate the pdf with your desired figure and then use
pdf2eps utility to get your eps file

- Use PHP to generate a LaTeX file, this LaTeX file will have the
defination of what figure you want to draw and run this LaTeX file
through latex2eps to get the desired eps file.

- There is a epslib class in PHP (just search for it), but it has been
written by a $RANDOM_GUY. You can use that library to generate your
eps, AFTER you have gone through his code and satisfied yourself
that it is of good quality


Is this even possible without getting into hardcore programming? Does
ImageMagick or GD offer some kind of vector-based file format? Is
there something that I'm not seeing in the documentation? If this is
better accomplished using the libraries and programs in Linux, that is
certainly an option.


Imagemagick has support for SVG. However, its support is still not
complete. You will get more info about that on IM's user mailing
list. Check imagemagick.org for supported formats that you can use.

--
Raj Shekhar Y! : Operations Engineer
MySQL DBA, programmer and slacker Y!IM : lunatech3007
home : http://rajshekhar.net blog : http://rajshekhar.net/blog/
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.