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?".
timmey21
Posts: 4 Joined: 2011-01-03T13:04:33-07:00
Authentication code: 8675308
Post
by timmey21 » 2011-01-03T13:13:05-07:00
Hi,
I'm not a proffesional with ImageMagick, but I want to convert a PDF to images (PHP). Code below works, but not with all pdf's.
Code: Select all
exec('/usr/bin/convert -density 300 -quality 80 magazine.pdf page.jpg');
With some PDF's i get the following error: " **** Warning: CS/cs (setcolorspace) operand not a name: ..."
Does anybody know how i can fix this problem?
Tim
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2011-01-03T13:42:52-07:00
the image withing the pdf is probably cmyk.
try adding -colorspace RGB before reading the image
exec('/usr/bin/convert -colorspace RGB -density 300 -quality 80 magazine.pdf page.jpg');
otherwise, you may need to use profiles
see
http://www.imagemagick.org/Usage/formats/#profiles
timmey21
Posts: 4 Joined: 2011-01-03T13:04:33-07:00
Authentication code: 8675308
Post
by timmey21 » 2011-01-03T13:57:51-07:00
Thank you for your quick reaction! I tried to add -colorspace RGB but it has no effect.
I visited the link about profiles, but how can i see wich profile I need for my PDF?
EDIT: I only get the error when i use the -density option. But i need this option for a good quality of the image.
Last edited by
timmey21 on 2011-01-05T12:16:48-07:00, edited 1 time in total.
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2011-01-03T15:47:48-07:00
what version of IM are you using and on what platform? perhaps you need to upgrade to fix your issue!
Your command works just fine for me (in command line IM) using IM 6.6.6.10 Q16 (hdri)
convert -density 300 -quality 80 magazine.pdf magazine.jpg
I get the first page of the pdf converted to a jpg
timmey21
Posts: 4 Joined: 2011-01-03T13:04:33-07:00
Authentication code: 8675308
Post
by timmey21 » 2011-01-04T03:31:18-07:00
My host is using "ImageMagick 6.2.8 10/20/10 Q16". Can that be the problem?
I will ask my host for an update.
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2011-01-04T10:15:22-07:00
IM 6.2.8 is very very old (over 350 versions old). So many things have been changed and improved and many bugs fixed. So upgrade if at all possible. Otherwise, I know of no other solution. But perhaps the IM developers can be more specific.
timmey21
Posts: 4 Joined: 2011-01-03T13:04:33-07:00
Authentication code: 8675308
Post
by timmey21 » 2011-01-05T12:16:29-07:00
Thank you very much!! The version was the problem, now it's working perfect