Convert CMYK PDF to JPG creates corrupt image.

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
atw

Convert CMYK PDF to JPG creates corrupt image.

Post by atw »

Hi guys,

I am trying to convert PDFs to JPGs on a LAMP (Linux, Apache, MySQL, PHP) server using this command:

Code: Select all

exec("convert test.pdf[0] -density 100 -sample 200x200 test.jpg");
This works brilliantly, most of the time. However, sometimes the results are less than desirable:
Image
Should look like this:
Image

The only difference between the results you see above is that I exported the first as High Quality Print and Press Quality from InDesign CS3 and the second one is exported as Smallest File Size from the same InDesign.

Obviously, they are of different file sizes but that doesn't seem to be the cause.

I believe it is caused by the first two being CMYK and the working one being RGB.

I do not know which version of ImageMagick is installed (or how to find out).

Please help. :)

---

Versions:

I have figured out how to determine the versions...

ImageMagick Convert ("convert -version"):

Code: Select all

ImageMagick 6.2.8 04/17/08 Q16 file:/usr/share/ImageMagick-6.2.8/doc/index.html Copyright: Copyright (C) 1999-2006 ImageMagick Studio LLC
GhostScript ("gs -h"):

Code: Select all

ESP Ghostscript 8.15.2 (2006-04-19)
Copyright (C) 2004 artofcode LLC, Benicia, CA.  All rights reserved.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert CMYK PDF to JPG creates corrupt image.

Post by snibgo »

You might install a versions that are less than four year old, and see if you still have the problem.
snibgo's IM pages: im.snibgo.com
atw

Re: Convert CMYK PDF to JPG creates corrupt image.

Post by atw »

snibgo wrote:You might install a versions that are less than four year old, and see if you still have the problem.
lol

I am in the process of trying to get the hosting company to update/upgrade the software :)

But they are SO SLOW :(
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert CMYK PDF to JPG creates corrupt image.

Post by fmw42 »

try

exec("convert -colorspace rgb test.pdf[0] -density 100 -sample 200x200 test.jpg");
atw

Re: Convert CMYK PDF to JPG creates corrupt image.

Post by atw »

fmw42 wrote:try

exec("convert -colorspace rgb test.pdf[0] -density 100 -sample 200x200 test.jpg");
Sorry fmw42, unfortunately your suggestion didn't fix the problem. Thank you for the suggestion though...
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert CMYK PDF to JPG creates corrupt image.

Post by fmw42 »

suggest you post one of your images that causes problems so someone can see if it is corrupt in some way or test on a different IM.
atw

Re: Convert CMYK PDF to JPG creates corrupt image.

Post by atw »

Hi,

I have spoken to the hosting providers and the installed versions are the current versions from the Linux distro's repositories :(

I have asked them to install from source or use the RPMs shown on this site but I suspect that they will refuse.

Is there an alternative which does not require installation (Java based maybe)?
atw

Re: Convert CMYK PDF to JPG creates corrupt image.

Post by atw »

fmw42 wrote:suggest you post one of your images that causes problems so someone can see if it is corrupt in some way or test on a different IM.
Sorry, newbie question alert. How would I attach a PDF to this board?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert CMYK PDF to JPG creates corrupt image.

Post by snibgo »

Put it on a website somewhere and post the URL here.
snibgo's IM pages: im.snibgo.com
atw

Re: Convert CMYK PDF to JPG creates corrupt image.

Post by atw »

No need.

I just finished creatine a VMware VM of Ubuntu 9.10 Server with LAMP, SSH, Samba and ImageMagick (the current version) and quess what; yep, it worked perfectly with the exact same PDF (the colour was a little off--suggesting that the PDF is, indeed CMYK).

This leaves me in the rather unfortunate situation that I cannot get the new version installed on the hosting package.

Is there an alternative way to proceed (maybe something similar to ImageMagick/GhostScript but Java based)? Or perhaps a good reputable RPM repository which host the appropriate RPMs for CentOS 5 64-bit...?

Any suggestions gratefully recieved...

Many thanks.
LooInSpain

Re: Convert CMYK PDF to JPG creates corrupt image.

Post by LooInSpain »

I'm using the same version of IM and Ghostscript on a shared server and was having the same problem. I managed to get around this with this command in IM:

Code: Select all

exec("convert -colorspace rgb -units PixelsPerInch -density 150x150 pdf/Serie-Irta.pdf  pdf/Serie-Irta.jpg");
Now instead of the jpg output like you showed in the first post, the pdf's convert pretty well. Not as good quality as with a later version of IM, but at least they are now converting.
Post Reply