Problem preserving Gradient when converting .PDF to .jpg

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
Mavent
Posts: 3
Joined: 2014-10-28T14:04:03-07:00
Authentication code: 6789

Problem preserving Gradient when converting .PDF to .jpg

Post by Mavent »

I run a website for a printer. I'm trying to create an automated Proofing system for them, but it's difficult because I just can't get IM to maintain gradients and color spaces. Here's an example of what I'm facing. The client uploaded a .pdf, and I had to convert it to .jpg for the Proof system. Unfortunately, it shifted the colors, and even worse, completely flattened the gradient:

Image


And there's the file itself: https://www.dropbox.com/s/l4i74jwt5yoks ... 4.pdf?dl=0

Anyone have any idea on how I can avoid this?
Thanks!
Last edited by Mavent on 2014-10-28T14:29:32-07:00, edited 1 time in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Problem preserving Gradient when converting .PDF to .jpg

Post by snibgo »

It would help if you provided the actual files, not screenshots.

But I will hazard a guess that the gradient comes from transparency. JPGs can't contain transparency, so the alpha channel is ignored. If you flatten the image against white, the gradation may be okay.
snibgo's IM pages: im.snibgo.com
Mavent
Posts: 3
Joined: 2014-10-28T14:04:03-07:00
Authentication code: 6789

Re: Problem preserving Gradient when converting .PDF to .jpg

Post by Mavent »

https://www.dropbox.com/s/l4i74jwt5yoks ... 4.pdf?dl=0

This is a dropbox link to the actual file. I opened it on Photoshop, and there is indeed a massive transparency. However, I've attempted to flatten it against a white background, and I'm still getting the same "flat blue" results. I'm obviously doing something wrong, but I can't figure out what it is.

EDIT: A developer friend of mine is telling me that there's a bug in the latest IM build that causes this problem. Does anyone know if this is true or not? :D
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Problem preserving Gradient when converting .PDF to .jpg

Post by Bonzo »

EDIT: A developer friend of mine is telling me that there's a bug in the latest IM build that causes this problem. Does anyone know if this is true or not?
What bug, has it been reported? Usually if there is a bug like that the developers get right onto it but only if they know about it.

What version are you running?

I tried converting the file to a png and jpg and the transparency was white but it was not like your original gradient; but better than your result.
It had a darker blue line across the top and the gradient ended sooner.
Version 6.8.8
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Problem preserving Gradient when converting .PDF to .jpg

Post by snibgo »

With IM v6.8.9-5 with Ghostscript v9.15, it converts fine for me. Mavent: if your versions are old, an update is needed, especially Ghostscript. (GS 9.10 gives results as Bonzo describes.)
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem preserving Gradient when converting .PDF to .jpg

Post by fmw42 »

On my Mac, I can find the version of GS by typing in the terminal window the following:

gs --version
9.10

For IM version

convert -version


Some other delegate versions can be found by

convert -list format


You should always provide your IM version and platform when asking questions.
Post Reply