PDF to EPS gradient problem

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Stonefury

PDF to EPS gradient problem

Post 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?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: PDF to EPS gradient problem

Post 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?
Stonefury

Re: PDF to EPS gradient problem

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: PDF to EPS gradient problem

Post 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.
Stonefury

Re: PDF to EPS gradient problem

Post 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.
Stonefury

Re: PDF to EPS gradient problem

Post 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.
Post Reply