Issue: convert PDF to JPG - Yellow color becomes Green

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
quaker
Posts: 3
Joined: 2015-05-22T05:25:03-07:00
Authentication code: 6789

Issue: convert PDF to JPG - Yellow color becomes Green

Post by quaker »

Hello guys,
I'm stuck trying to convert PDF to JPG files.

The issue is, that the (light) yellow color on the PDF's first page becomes (light) green on exported JPGs.


Image


When I export the PDF as JPG from Adobe Acrobat, (applying sRGB IEC61966-2.1 profile) it looks fine.
But I need to do that on the ImageMagick's side.


I blindly tried few Color Profiles (eg. sRGB_v4_ICC_preference.icc, AdobeRGB1998.icc), but nothing help.


Do you know what might be wrong?

Used cmd: convert -verbose -density 72 -profile AdobeRGB1998.icc -quality 100 file.pdf file.jpg
PDF file: http://46.41.130.153/pdf/file.pdf
JPG exported from Adobe Acrobat: http://46.41.130.153/pdf/adobe.jpg
JPG exported from ImageMagick: http://46.41.130.153/pdf/convert.jpg
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Issue: convert PDF to JPG - Yellow color becomes Green

Post by snibgo »

For starters, try the command in the correct order: read the input, process it, and write it:

Code: Select all

convert -verbose -density 72 file.pdf -profile AdobeRGB1998.icc -quality 100 file.jpg
But what are you trying to do with colour profiles? Converting the PDF to PNG, with no profiles:

Code: Select all

convert file.pdf m.png
... then viewing the PDF in Adobe Reader, and the PNG in MS Photo Viewer, they look the same to me.

IM v6.9.1-0 on Windows 8.1.
snibgo's IM pages: im.snibgo.com
quaker
Posts: 3
Joined: 2015-05-22T05:25:03-07:00
Authentication code: 6789

Re: Issue: convert PDF to JPG - Yellow color becomes Green

Post by quaker »

Thank you for your reply, but it doesn't solve my issue.

When I do:

Code: Select all

convert -verbose -density 72 file.pdf -profile AdobeRGB1998.icc -quality 100 file.jpg
It generates JPGs, but with wrong color (same as before - the yellow becomes green).
The same result with PNG:

Code: Select all

convert file.pdf m.png

Image


I tried:
ImageMagick 6.6.9-7 under Ubuntu 12
ImageMagick 6.7.7-10 under Debian 7
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Issue: convert PDF to JPG - Yellow color becomes Green

Post by snibgo »

Code: Select all

convert file.pdf m.png
With this simple convert, not using profiles, I get yellow #ffff98. This is practically the same as your desired #ffff9a.

You are using very old versions of IM. If you don't get #ffff98, upgrading might fix the problem.

If you assign a profile, you will correctly get a different colour. Why do you want to asign the AdobeRGB1998 profile?
snibgo's IM pages: im.snibgo.com
quaker
Posts: 3
Joined: 2015-05-22T05:25:03-07:00
Authentication code: 6789

Re: Issue: convert PDF to JPG - Yellow color becomes Green

Post by quaker »

Thank you for your assistance.
I've found a sollution.

ImageMagick was installed from the latest server's repository,
but even when I installed the latest ImageMagick (6.9.1-2) based on http://www.imagemagick.org/script/install-source.php,
the result was the same.

The issue was an old GhostScript version:
# gs --version

Code: Select all

9.05
I upgraded it to the latest one:
9.16

But then another issue appeared:
alpha / transparency was converted to black,
so I had the right color, but most of the area was black.


The sollution for it was to use: -alpha remove

So the final cmd is:

Code: Select all

convert -verbose file.pdf -alpha remove jpg/file.jpg
:-)

I'm happy I've found a sollution,
thank you for your replies
and I hope it will help someone else.


Best regards!
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Issue: convert PDF to JPG - Yellow color becomes Green

Post by Bonzo »

Thanks for getting back with the answer quaker.
Post Reply