Preserve colors when converting CMYK to sRGB in CMYK Imagick PHP

I am trying to convert the original CMYK image (Coated FOGRA27 (ISO 12647-2: 2004) to sRGB (Apple RGB) and then back to CMYK (Coated FOGRA27 (ISO 12647-2: 2004)) and keep all the colors as they were via Imagick in PHP Now my knowledge of colors is not very high, but I would like to get as close to the original as possible, but after conversion the color intensity seems to be completely off. I was wondering if anyone knows the solution to keep the original colors.

All original and converted images are here for reference: https://drive.google.com/drive/folders/0B0_03DCODKMJVXRvRUhPQTh6ZjA?usp=sharing

I am using the following code to convert the original image to sRGB (colors seem fine after)

$img = new Imagick();

$img->readImage(  URL::to('/storage/' . 'images/7961_58d5017e0c3a6_2k_749/original/2k_749.jpeg') );

$img = Image::make( $img );

$img_core = $img->getCore();

$img_core->profileImage('icc', Storage::get('color_profiles/AppleRGB.icc'));

$img_core->transformimagecolorspace(\Imagick::COLORSPACE_SRGB);

Storage::put( 'images/7961_58d5017e0c3a6_2k_749/original/2k_749_rgb.jpeg', $img->stream('jpg', 100) );

      

I am using the following code to convert an image back to CMYK

$img = new Imagick();

$img->readImage(  URL::to('/storage/' . 'images/7961_58d5017e0c3a6_2k_749/original/2k_749_rgb.jpeg') );

$img = Image::make( $img );

$img_core = $img->getCore();
$img_core->setImageUnits(imagick::RESOLUTION_PIXELSPERINCH);
$img_core->setImageResolution(300,300);

$img_core->profileImage('icc', Storage::get('color_profiles/CoatedFOGRA27.icc'));

$img_core->transformimagecolorspace(\Imagick::COLORSPACE_CMYK);

$return = Storage::put( 'images/7961_58d5017e0c3a6_2k_749/original/2k_749_conv.jpeg', $img->stream('jpg', 100) );

      

After this color conversions are disabled, when using Photoshop to convert the sRGB to CMYK version, the colors seem to be pretty much the same, I was hoping this could also be achieved with Imagick in PHP.

Thank!

+3


source to share





All Articles