Page 1 of 1

EPS Vector in - EPS Vector out?

Posted: 2007-11-14T10:27:11-07:00
by ChrisM
With MagickWand for PHP, is it possible to read in a vector based EPS file (created in Adobe Illustrator), add some text to the image, and then output the whole thing in vector format?

I'm struggling to get my head around the techniques involved and am trying to adapt the original MagickWand example. Here's the code I have so far:

Code: Select all

<?php

$font_file = '100.ttf';
$photo_file = 'test.eps';

$magick_wand=NewMagickWand();
MagickSetFormat($magick_wand, 'eps');
MagickReadImage($magick_wand,$photo_file);

$drawing_wand=NewDrawingWand();

DrawSetFont($drawing_wand,"$font_file");
DrawSetFontSize($drawing_wand,100);
DrawSetGravity($drawing_wand,MW_CenterGravity);
$pixel_wand=NewPixelWand();
PixelSetColor($pixel_wand,"#c0c0c0");
DrawSetFillColor($drawing_wand,$pixel_wand);

if (!IsDrawingWand($drawing_wand)) echo "\$drawing_wand is not a DrawingWand resource";

if (MagickAnnotateImage($magick_wand,$drawing_wand,0,0,0,"Rose") != 0) {
	header('Content-type: image/eps');
	header('Content-Disposition: attachment; filename="vector_test.eps"');
	MagickEchoImageBlob( $magick_wand );
} else {
	echo "Exception: " . MagickGetExceptionString($magick_wand);
}
?>
This works, but produces a non-vector image which looks much like a low quality JPEG/GIF. Can anyone help or point me in the right direction?

Thanks in advance.

Re: EPS Vector in - EPS Vector out?

Posted: 2007-11-14T11:33:30-07:00
by magick
ImageMagick rasterizes vector files into pixels. For vector-in to vector-out you will need to use some other application.

Re: EPS Vector in - EPS Vector out?

Posted: 2007-11-14T11:44:22-07:00
by ChrisM
Thanks for clarifying that. Any suggestions on what other software I can use to output vector-based EPS images with PHP?

Re: EPS Vector in - EPS Vector out?

Posted: 2007-12-12T16:59:57-07:00
by anthony
See A Word about Vector Image Formats, which also includes links to alternatives.