Page 1 of 1
I can have CMYK to RGB or CGI scripts but not both!!
Posted: 2007-03-03T10:31:10-07:00
by halcongris
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?
Re: I can have CMYK to RGB or CGI scripts but not both!!
Posted: 2007-03-03T11:02:02-07:00
by magick
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!!
Posted: 2007-03-03T11:13:32-07:00
by halcongris
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?
Re: I can have CMYK to RGB or CGI scripts but not both!!
Posted: 2007-03-03T13:05:45-07:00
by magick
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
Posted: 2007-03-04T02:19:51-07:00
by halcongris
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!!
Posted: 2007-03-05T19:25:45-07:00
by RXGX
If the JPG has errors, bring it into your graphics program and check the color profile. Most likely, it's still CMYK.