Intervention/image · error · Intervention\Image\Exceptions\ModifierException
Failed to apply {class}, unable to re-apply icc profile
Error message
Failed to apply {class}, unable to re-apply icc profile What it means
Final failure step of the Imagick StripMetaModifier: metadata was stripped, and re-applying the preserved ICC profile via Imagick::profileImage('icc', $profiles['icc']) returned false. The image is caught mid-pipeline - stripped but without its color profile - so the modifier aborts instead of silently delivering an untagged image.
Source
Thrown at src/Drivers/Imagick/Modifiers/StripMetaModifier.php:57
throw new ModifierException(
'Failed to apply ' . self::class . ', unable to strip meta data',
);
}
} catch (ImagickException $e) {
throw new ModifierException(
'Failed to apply ' . self::class . ', unable to strip meta data',
previous: $e,
);
}
$image->setExif(new Collection());
if ($profiles !== []) {
// re-apply icc profiles
try {
$result = $image->core()->native()->profileImage("icc", $profiles['icc']);
if ($result === false) {
throw new ModifierException(
'Failed to apply ' . self::class . ', unable to re-apply icc profile',
);
}
} catch (ImagickException $e) {
throw new ModifierException(
'Failed to apply ' . self::class . ', unable to re-apply icc profile',
previous: $e,
);
}
}
return $image;
}
}
View on GitHub (pinned to 5598b9e397)
Solutions
- Inspect getPrevious() and test the source file with 'identify -verbose' to see if its ICC profile is malformed
- Skip profile preservation by stripping the profile externally before processing
- Re-encode without strip: true for the affected files
- Verify LCMS delegate support in the ImageMagick build
Example fix
// before
$encoded = $image->encode(new WebpEncoder(quality: 85, strip: true));
// after
try {
$encoded = $image->encode(new WebpEncoder(quality: 85, strip: true));
} catch (ModifierException $e) {
$logger->warning('ICC re-apply failed: ' . $e->getMessage());
$encoded = $image->encode(new WebpEncoder(quality: 85));
} Defensive patterns
Strategy: try-catch
Try / catch
use Intervention\Image\Exceptions\ModifierException;
try {
$encoded = $image->encode(new WebpEncoder(quality: 85, strip: true));
} catch (ModifierException $e) {
$logger->warning('Could not re-attach ICC profile: ' . $e->getMessage());
$encoded = $image->encode(new WebpEncoder(quality: 85));
} Prevention
- Validate or strip ICC profiles at upload time for untrusted files
- Keep LCMS delegate present and current in the ImageMagick build
When it happens
Trigger: $image->encode(new WebpEncoder(strip: true)) or similar when the previously saved ICC blob cannot be re-attached: malformed or truncated profile, a profile ImageMagick's LCMS rejects, or a format whose wand state changed after stripImage().
Common situations: Sources with broken or non-standard ICC profiles (common in files from obscure editors/scanners); mixing color profiles across re-encodes; ImageMagick without proper LCMS support failing validation of the blob.
Related errors
- Failed to apply ' . self::class . ', unable to re-apply icc
- Failed to apply {class}, unable to preserve icc profiles
- Failed to apply {class}, unable to strip meta data
- No ICC profile found in image
- Failed to encode webp format
AI-assisted analysis of Intervention/image@5598b9e397 (2026-08-23).
Data as JSON: /api/errors/b581521be946a624.
Report an issue: GitHub.