A bit of a nightmare! With ImageMagick 6.2.5, Apache 2.0.50 and ActivePerl 5.8.8 I can convert a PDF CMYK into a jpeg RGB with no problems as a standalone Perl script but it won't run as a CGI. As soon as I include the line "use Image::Magick " the server returns a "bad headers" message.
If I switch to ImageMagick 6.3.2 the CGI script runs fine but the jpeg produced is incorrect - the blacks disappear and the other colours get messed up.
Any ideas as to how to have the best of both worlds?
I can have CMYK to RGB or CGI scripts but not both!!
Re: I can have CMYK to RGB or CGI scripts but not both!!
You are creating a CMYK JPEG image but you most likely want a RGB JPEG image. Specify RGB before the image is read or use two color profiles to make the conversion (e.g. one sRGB and one Swop). The most convenient method from the command line:
- convert -colorspace rgb cmyk.pdf rgb.pdf
Re: I can have CMYK to RGB or CGI scripts but not both!!
But the program works perfectly with IM 6.2.5:
use Image::Magick;
$newsport = Image::Magick->new();
$newsport->Read(filename=>"pdf:LG01.pdf");
$newsport->Resize(width=>200,height=>286,filter=>Lanczos);
$newsport->Write(filename=>"jpg:test03K.jpg",colorspace=>RGB);
But it doesn't work with 6.3.2 and 6.2.5 won't run as CGI script.
Is there a bug in 6.3.2 colour handling?
use Image::Magick;
$newsport = Image::Magick->new();
$newsport->Read(filename=>"pdf:LG01.pdf");
$newsport->Resize(width=>200,height=>286,filter=>Lanczos);
$newsport->Write(filename=>"jpg:test03K.jpg",colorspace=>RGB);
But it doesn't work with 6.3.2 and 6.2.5 won't run as CGI script.
Is there a bug in 6.3.2 colour handling?
Re: I can have CMYK to RGB or CGI scripts but not both!!
6.2.5 did not automatically converted CMYK PDF images to RGB. However, this is not what all users want. Some users want CMYK PDF's to remain in the CMYK colorspace. The fix is simply to change your script:
- newsport = Image::Magick->new(colorspace=>'RGB');
$newsport->Read(filename=>"pdf:LG01.pdf");
Re: PDF now converts but TIF causes web browsers to complain
Many thanks for your help. The script now converts PDF to JPG fine but when it converts a TIF to JPG, the resulting image looks OK in a PaintShop Pro or GIMP but a browser such as Firefox complains that there are errors in the image. Any clues?
Re: I can have CMYK to RGB or CGI scripts but not both!!
If the JPG has errors, bring it into your graphics program and check the color profile. Most likely, it's still CMYK.