0

If not, do you think it would take an arm and a leg to create such a class?

Mihai
  • 68
  • 6

1 Answers1

4

I would start by taking a look at the PHP Imagick library, and installing that.

In Unix, a command such as convert file.ai output.eps should work, so you should be able to run the conversion using the PHP version of the ImageMagick library (the convert utilities in Unix are backed by the same library).

And indeed, a snippet such as:

$im = new Imagick('image.ai');
$im->setImageFormat('eps');
$im->writeImage('image.eps');

should do the trick.

Note: in case the resulting image contains artifacts of any kind, make sure you read the PHP documentation for extra parameters that might need to be specified. As an example - when converting to PNG to JPG, you need to specify a background color for the new JPG image and then you also need to flatten the image in order to get the output. I am not very familiar with the EPS and AI formats, which is why I can't give you any relatively accurate pointers.

Edit:

Here's another question with a similar task that has a great answer which suggests that .ai files should work with Imagick.

Community
  • 1
  • 1
Andrei Bârsan
  • 3,473
  • 2
  • 22
  • 46
  • Although .ai doesn't seem to be on the list of formats supported by imagick I'll give it a go and come back with the results. – Mihai May 02 '13 at 15:20
  • The simple code Andrei wrote works great format-wise, but the eps file generated doesn't keep the original vector outlines; even so, this looks like the best solution available at the moment. – Mihai May 02 '13 at 19:42