Php – ImageMagick failing to convert to JPG

imagemagickPHP

We recently installed the latest version of ImageMagick onto our Linux server. I seem to be having issues performing the most basic of tasks.

I am running this command line:

/usr/bin/convert /location/to/source/design.ai /location/to/save/output.jpg

Unfortunatly is saves design.jpg as an illustrator file (if I rename the file to output.ai it opens). Even if I do this:

/usr/bin/convert /location/to/source/design.ai -rotate 90 /location/to/save/design.jpg

It rotates the file and saves again as an illustrator document. This happens with all filetypes (e.g. png, bmp, etc…)

It appears ImageMagick cannot figure out what I want it converted to and just saves as the same file type.

Any ideas on fixing this?

Regards:

John

Best Answer

Are you sure ImageMagick supports Illustrator files? That's a proprietary format that isn't supported by any programs outside of the the Adobe family AFAIK. I would be very surprised if ImageMagick supported it. It's also not listed on the ImageMagic supported formats page.

Try saving as a PDF, SVG, or any of the supported formats before you pass it to ImageMagick.

Edit:

There appears to be a way to read/manipulate AI files using ImageMagick, but this comes with the proviso that the AI file must be saved with PDF compatibility. If not, it will not work, as ImageMagick by default is configured to read AI files using its PDF coder. Though that isn't to say that someone can't write a custom AI coder for it. However, I've yet to see one and it would be difficult given that AI itself is a closed format (even the latest version of QuarkXpress has imperfect AI support).