Page 1 of 1

PDF to EPS gradient problem

Posted: 2009-06-30T08:33:26-07:00
by Stonefury
I am trying to use Imagemagick to convert PDF to EPS. However, the resulting EPS ends up with gradients looking chopped up, when they looked fine in the PDF. By chopped up I mean there are tons of horizontal and vertical transparent lines running through it, making it look like a fine sieve. If I put a colored box behind it I can see the color through the gradient, even though the original gradient had no transparency (just solid yellow to solid red, for example).

I am not sure whether the problem is the conversion or the pdf, because I get an error when I do the conversion that says:

Warning: File has imbalanced q/Q operators (too many q's)
This file had errors that were repaired or ignored.

Is there any way I can fix this?

Re: PDF to EPS gradient problem

Posted: 2009-06-30T08:40:08-07:00
by magick
Convert your PDF to PNM. Does the PNM image look right? We're trying to determine if the problem is in the PDF source image or in the EPS destination image. What version of ImageMagick are you using? Can you try the latest release, 6.5.4-1?

Re: PDF to EPS gradient problem

Posted: 2009-06-30T10:01:24-07:00
by Stonefury
I seem to have Imagemagick 6.5.4 Q16. I downloaded it maybe two days ago, is this different than 6.5.4-1?

The PNM looks right, but it has been rasterized. I'm trying to preserve the image as a vector. With simple convert the EPS remains a vector, but with the aforementioned problem. If I add something like -resize 90% to the EPS conversion, the chopping is gone but the image becomes rasterized. So it looks like the chopping up only occurs when the converted file is not rasterized.

Re: PDF to EPS gradient problem

Posted: 2009-06-30T11:24:54-07:00
by magick
That looks like a bug in Ghostscript. In order to preserve the vectors, ImageMagick directs Ghostscript to make a direct conversion from PDF to EPS. If you use any ImageMagick command line options, the PDF is first rasterized.

Re: PDF to EPS gradient problem

Posted: 2009-06-30T15:46:01-07:00
by Stonefury
Well all I want to do is a direct conversion, I just need the result to look like the PDF. I had hoped there was something I could add to the convert line that might fix it, I guess it's not that simple.

Re: PDF to EPS gradient problem

Posted: 2009-06-30T15:56:20-07:00
by Stonefury
I tried saving the original image as .ps instead of .pdf and then doing convert image.ps image.eps

This gave an acceptable-looking result, but the file size blew up from 1.4KB to 12.6MB for a very simple test image.