Created
January 31, 2024 13:39
-
-
Save ethaniel/11ecf0e863047b3480cf2ff8f7948cf6 to your computer and use it in GitHub Desktop.
Solution for: icc_transform error. Message: libvips error: icc_transform: no output profile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// If you are using PHP Imagine, then you can catch the "icc_transform error. Message: libvips error: icc_transform: no output profile" error | |
// Then you need to remove the icc-profile-data and repeat the call | |
try { | |
$img = $img->thumbnail($box, Imagine\Image\ImageInterface::THUMBNAIL_OUTBOUND); | |
} catch (\Exception $e) { | |
if (strstr($e->getMessage(), "icc")) { | |
$img->getVips()->remove('icc-profile-data'); | |
$img->updatePalette(); | |
$img = $img->thumbnail($box, Imagine\Image\ImageInterface::THUMBNAIL_OUTBOUND); | |
} else { | |
throw $e; // can't do anything. this is some other problem | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment