Working with Adobe Illustrator Files (*.ai) and EPS (*.eps)

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
Guns

Working with Adobe Illustrator Files (*.ai) and EPS (*.eps)

Post by Guns »

Hi everyone,

I've tried Image Magick to convert AI|EPS files(from graphic department) to JPG, first with the command-line tool then with Imagick, no problem so far. Making thumbnails and watermarks were just easy to make(thanks to this great API!).

But when I tried with a new bunch of AI's, it ended up with failure at line :

Code: Select all

try
{
	$img = new Imagick('my_image_file.ai');
}
catch (ImagickException $e)
{
	echo $e->getMessage();
}
With the following output :
Wand contains no images `MagickWand-3'
or
Wand contains no images `MagickWand-2'
I also tried to convert manually by the command line and made GhostScript insulting me =(

Code: Select all

 
$> convert my_file.ai my_file.jpg  
   **** Warning:  An error occurred while reading an XREF table.
   **** The file has been damaged.  This may have been caused
   **** by a problem while converting or transfering the file.
   **** Ghostscript will attempt to recover the data.
ERROR: /typecheck in --known--
Operand stack:
   1   1   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   Kids
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1   3   %oparray_pop   1   3   %oparray_pop   1   3   %oparray_pop   --nostringval--   --nostringval--   2   1   1   --nostringval--   %for_pos_int_continue   --nostringval--   --nostringval--   --nostringval--   --nostringval--   %loop_continue   --nostringval--   1   1   0   --nostringval--   %for_pos_int_continue   --nostringval--
Dictionary stack:
   --dict:1127/1686(ro)(G)--   --dict:0/20(G)--   --dict:107/200(L)--   --dict:107/200(L)--   --dict:104/127(ro)(G)--   --dict:241/347(ro)(G)--   --dict:21/24(L)--
Current allocation mode is local
ESP Ghostscript 815.02: Unrecoverable error, exit code 1
I get this error when Imagick API gives me the error : Wand contains no images `MagickWand-3'

And :

Code: Select all

ERROR: /limitcheck in --.shfill--
Operand stack:
   --dict:11/11(L)--   --dict:10/15(L)--   --nostringval--
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1   3   %oparray_pop   1   3   %oparray_pop   1   3   %oparray_pop   --nostringval--   --nostringval--   2   1   1   --nostringval--   %for_pos_int_continue   --nostringval--   --nostringval--   --nostringval--   --nostringval--   1   %stopped_push   --nostringval--   --nostringval--   --nostringval--   1   %stopped_push   --nostringval--   --nostringval--   --nostringval--   %array_continue   --nostringval--   false   1   %stopped_push   --nostringval--   %loop_continue   2   11   %oparray_pop   --nostringval--   false   1   %stopped_push
Dictionary stack:
   --dict:1127/1686(ro)(G)--   --dict:0/20(G)--   --dict:107/200(L)--   --dict:107/200(L)--   --dict:104/127(ro)(G)--   --dict:241/347(ro)(G)--   --dict:20/24(L)--   --dict:4/6(L)--   --dict:20/31(L)--   --dict:1/1(ro)(G)--   --dict:1/1(ro)(G)--
Current allocation mode is local
Last OS error: 2
ESP Ghostscript 815.02: Unrecoverable error, exit code 1
When Imagick gives me Wand contains no images `MagickWand-2'

However I was able to open both files which gave me those 2 errors with Acrobat PDF Reader and Adobe Illustrator CS4, they looked good to me. Opening them with some text editors shown me some good headers too.

PHP scripts and binaries are running under :
- CentOS 5.2
- PHP 5.1.6
- Imagick 2.3.0 (PECL guy said)
- ImageMagick & ImageMagick-devel both 6.2.8.0
- GhostScript 8.15.2

Questions are :
Is my PHP too old ?
Is my ImageMagick or ImageMagick-devel too old ?
Is Imagick too old ?
Is GhostScript too old ?
Are these graphists making some bad files ? because I never had problem like this before

I never used Abode Illustrator so i may be missing some information, don't hesitate to ask me if i did miss something.

Thanks !
Hope I'll see you soon !

Damien

PS: Sorry about my english, french guy here :)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Working with Adobe Illustrator Files (*.ai) and EPS (*.eps)

Post by magick »

ImageMagick relies on the Ghostscript delegate library or program to render Postscript / PDF. You could try upgrading Ghostscript and see if that helps. Otherwise you will need to post to the Ghostscript forums for further help.
Guns

Re: Working with Adobe Illustrator Files (*.ai) and EPS (*.eps)

Post by Guns »

Thanks for your reply !

I updated GhostScript and I doesn't fix it.

I tried to run the command-line which is supposed to be run when converting AI to JPEG(in delegate.xml) and GS says Adobe PDF Library 5.0 repaired or ignored error but a jpg file is still generated(header seems to be good but no image in it :( )

Files may be damaged or corrumpted since I get this error only on this bunch of image.

I have another question concerning EPS files :
Is it possible to only extract the artboard of Adobe Illustrator for example when converting EPS to jpg?
When you use "Save for Web" in adobe illustrator, only the artboard is converted but IM convert everything in and out the artboard. Sorry if I'm not explaining it well.

And if i have to : "Is it possible to change Imagick's delegates API and tell GS to select the artboard only ?"

Thanks alot !
Post Reply