Page 1 of 1

EPS to JPG - Low quality output?

Posted: 2008-10-08T10:31:15-07:00
by cranky
Hi Everyone,

I am trying to convert EPS files in JPG images. It is working, except the output is very low quality. The colors are blotchy lines are blurry. It looks like the image is being upsampled.

Here is the code I am using - am I doing something wrong? I get the feeling I must be missing a key step.

Code: Select all

$blob = file_get_contents("test.eps"); 
$wand = NewMagickWand(); 
MagickReadImageBlob($wand, $blob); 
$new_wand = MagickTransformImage($wand, NULL, '800x'); 
MagickSetImageFormat($new_wand, 'jpg') ;
MagickStripImage($new_wand);
MagickWriteImage($new_wand, "test.jpg"); 
DestroyMagickWand($new_wand); 
DestroyMagickWand($wand);
Any help would be greatly appreciated!

Thanks

Re: EPS to JPG - Low quality output?

Posted: 2008-10-08T12:54:19-07:00
by magick
Try
  • MagickSetResolution( $wand, 300, 300 );
before you call MagickReadImageBlob().

Re: EPS to JPG - Low quality output?

Posted: 2008-10-08T13:18:09-07:00
by cranky
Hey magick,

Thanks for the speedy feedback.

I don't actually call MagickReadImage() - I call MagickReadImageBlob(). I still tried inserting MagickSetResolution($new_wand, 300, 300) as you suggested, but it did not seem to make any difference. The result still appeared upsampled.

You note in your example that MagickSetResolution() would reference $new_wand - however, $new_wand is not declared until well after the image is read. So this confuses me a little bit further.

Any suggestions? Thanks!

Re: EPS to JPG - Low quality output?

Posted: 2008-10-08T15:38:37-07:00
by magick
See the edits of the original message. Does it still fail for you?

Re: EPS to JPG - Low quality output?

Posted: 2008-10-08T16:21:11-07:00
by cranky
Thank you for the reply. No, unfortunately it still looks the same as before.

I think the best way to describe the image is "blotchy". The color areas should be smooth and uniform, but instead they are faded and have patterns through them. The lines should be smooth and crisp, but instead are made up of jagged edges. I would post a sample, but unfortunately all the images are copyrighted.

Do you have any other ideas what might possibly be the problem, or solution?

Thank you!

Re: EPS to JPG - Low quality output?

Posted: 2008-10-08T18:00:09-07:00
by magick
Ok, let the debugging begin. First try this command:
  • convert -density 300x300 test.eps test.jpg
also try
  • convert -density 300x300 -colorspace rgb test.eps -quality 92 test.jpg
Do these command return reasonable results?

Re: EPS to JPG - Low quality output?

Posted: 2008-10-09T08:02:57-07:00
by cranky
Hi Magick,

Running those commands directly from shell returned the following result:

Code: Select all

[root@Server6482 temp]# convert -density 300x300 test.eps test.jpg
sh: gs: command not found
sh: gs: command not found
convert: Sorry, can not handle image with PhotometricInterpretation=4. `test.eps'.

Code: Select all

[root@Server6482 temp]# convert -density 300x300 -colorspace rgb test.eps -quality 92 test.jpg
sh: gs: command not found
sh: gs: command not found
convert: Sorry, can not handle image with PhotometricInterpretation=4. `test.eps'.
Does that make any sense to you? I have only ever used ImageMagick through PHP MagickWand, so I am completely unfamiliar with it on a command line level.

Thank you again!

Re: EPS to JPG - Low quality output?

Posted: 2008-10-09T09:36:27-07:00
by magick
ImageMagick requires Ghostscript to interpret Postscript. Check your system and see if its installed. If not, install it.

Re: EPS to JPG - Low quality output?

Posted: 2008-10-09T10:49:35-07:00
by cranky
Hello again,

I checked Ghostscript and it does appear to be installed:

Code: Select all

[root@Server6482 ~]# rpm -qa |grep -i ghost
ghostscript-7.07-33.2.el4_6.1
ghostscript-fonts-5.50-13

Code: Select all

[root@Server6482 ~]# rpm -qa |grep -i image
ImageMagick-6.0.7.1-16.0.3
ImageMagick-devel-6.0.7.1-16.0.3
Do those install versions possibly shed any light on the problem? Or could it be completely unrelated?

Thanks again!

Re: EPS to JPG - Low quality output?

Posted: 2008-10-09T11:01:47-07:00
by magick
Type
  • where gs
    convert -verbose -density 300 test.eps -quality 92 test.jpg
Gs must not be in your execution path otherwise ImageMagick would find it. We're trying to find a good starting point to debug your problem.

You can also consider installing the latest ImageMagick release, 6.4.4-2, to see if that has any positive effect on the problem

Re: EPS to JPG - Low quality output?

Posted: 2008-10-09T11:17:41-07:00
by cranky
Magick,

I had my hosts reinstall ImageMagick and Ghostscript and they both work properly now - the images are appearing as I could expect. Thanks for all your help!