469,086 Members | 1,187 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,086 developers. It's quick & easy.

Vector EPS/PS from PHP & ImageMagick or GD

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
1 12009
"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.

Similar topics

1 post views Thread by Randell D. | last post: by
5 posts views Thread by nawfer | last post: by
3 posts views Thread by Chuck Anderson | last post: by
1 post views Thread by Jim Red | last post: by
3 posts views Thread by Pekka Karjalainen | last post: by
6 posts views Thread by eholz1 | last post: by
2 posts views Thread by azrael | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by kglaser89 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.