PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, September 19, 2022

[FIXED] How to resolve the “ColorspaceColorProfileMismatch 'icc'” conflict when creating an image?

 September 19, 2022     imagick, php     No comments   

Issue

Good day, dear $user!

There is a source file in "in.png" PNG format with sRGB scheme. Must be converted to "TIFF" with CMYK scheme and FOGRA27 profile.

When the script is run, the exception "ColorspaceColorProfileMismatch` icc '@error/profile.c/ProfileImage/866 "

What's my mistake?

$inFile = in.png 
$outFile = out.tiff

$base = new Imagick($inFile);
$base->transformImageColorspace(Imagick::COLORSPACE_CMYK);
$base->mergeImageLayers( Imagick::LAYERMETHOD_MERGE);
$base->profileImage('icc', Storage::disk('local')->url('icc_profile/forga27.icc'));
$base->setImageUnits(1);
$base->setImageResolution(127,127);
$base->setCompression(11);
$base->setImageFormat("tiff");
$base->writeImage($outFile);
$base->destroy();

Solution

Instead of Storage::disk ('local')->get('icc_profile/fogra27.icc') I passed url (Storage::disk('local')->url('icc_profile/forga27.icc'))

Thank.



Answered By - devAston
Answer Checked By - Katrina (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing