[magick-users] Magickwand for PHP, CMYK to RGB

Norbert Bißmeyer n.bissmeyer at mcrobots.de
Tue Jan 8 06:01:21 PST 2008


Hi,
I am working with magickwand for php and try to convert an image from
CMYK to RGB. I read something about the usage about ICC profiles and
found one solution to convert the image with the following code:

$resource = NewMagickWand();
MagickReadImage( $resource, "CMYK.tif" );
if( MagickGetImageColorspace( $resource ) == MW_CMYKColorspace ){
    MagickRemoveImageProfile( $resource, "ICC" );
    MagickSetImageProfile( $resource, 'ICC', file_get_contents(
'USWebCoatedSWOP.icc') );   
    MagickProfileImage($resource, 'ICC', file_get_contents( 'sRGB.icc') );
    MagickSetImageColorspace( $resource, MW_RGBColorspace );
}
MagickSetImageCompressionQuality( $resource, 85 );
MagickSetImageFormat( $resource, 'JPG' );
MagickWriteImage( $resource, "RGB.jpg" );
DestroyMagickWand( $resource );

The result image is not very good. The colors are not different and I
cannot really use this image.
Have anyone a solution to get a better result?

reagrds
Norbert


More information about the Magick-users mailing list