1
votes

I am trying to use Imagick() to convert ai, psd file to jpg file and display it for preview thumbnails.I was success to convert .psd file to jpg but i don't have any idea how to convert ai file to jpg.

Here is the php code that i use to convert psd to jpg

$im = new Imagick('asd.psd');    
$im->setIteratorIndex(0);   
$im->stripImage();   
$im->setImageCompressionQuality(80);   
$im->writeImage('1.jpg');

I was try to use above same code to convert ai file, but it was show below error::

Fatal error: Uncaught exception 'ImagickException' with message 'PDFDelegateFailed `[ghostscript library] -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pam" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -dUseCIEColor "-sOutputFile=/tmp/magick-250295ZIcan0qH3a0p%d" "-f/tmp/magick-250295BABXRURgbnUr" "-f/tmp/magick-250295HPtOsqaxXIOt"': -dname= must be followed by a valid token @ error/pdf.c/InvokePDFDelegate/263' in /home/genioomy/public_html/demo/testing-area/test.php:55 Stack trace: #0 /home/genioomy/public_html/demo/testing-area/test.php(55): Imagick->__construct('asd.ai') #1 {main} thrown in /home/genioomy/public_html/demo/testing-area/test.php on line 55

1

1 Answers

0
votes

AI is essentially a wrapper for encapsulated postscript. You will have to have GhostScript active in order to convert it.

That being said, if you save the AI with the PDF compatibility option set to TRUE, then it should be able to use the PDF information to give you the result you want.

Try converting two versions, one with PDF compatibility "on" and one "off", and observe the results.