Page 1 of 1
Cannot convert all pdf's
Posted: 2011-01-03T13:13:05-07:00
by timmey21
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
Re: Cannot convert all pdf's
Posted: 2011-01-03T13:42:52-07:00
by fmw42
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
Re: Cannot convert all pdf's
Posted: 2011-01-03T13:57:51-07:00
by timmey21
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.
Re: Cannot convert all pdf's
Posted: 2011-01-03T15:47:48-07:00
by fmw42
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
Re: Cannot convert all pdf's
Posted: 2011-01-04T03:31:18-07:00
by timmey21
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.
Re: Cannot convert all pdf's
Posted: 2011-01-04T10:15:22-07:00
by fmw42
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.
Re: Cannot convert all pdf's
Posted: 2011-01-05T12:16:29-07:00
by timmey21
Thank you very much!! The version was the problem, now it's working perfect