Skip to content

Instantly share code, notes, and snippets.

@ethaniel
Created January 31, 2024 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ethaniel/11ecf0e863047b3480cf2ff8f7948cf6 to your computer and use it in GitHub Desktop.
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
<?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