Intervention/image · error · ModifierException
Failed to apply ' . self::class . ', unable to re-apply icc
Error message
Failed to apply ' . self::class . ', unable to re-apply icc profile
What it means
Final failure step of the Imagick StripMetaModifier, exception variant: profileImage('icc', ...) threw an ImagickException while re-attaching the preserved ICC profile after stripImage(). It is wrapped as ModifierException with the original attached. The message text in the source contains a concatenation placeholder, but the runtime message is 'Failed to apply ..., unable to re-apply icc profile'.
Source
Thrown at src/Drivers/Imagick/Modifiers/StripMetaModifier.php:62
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
- Read getPrevious()->getMessage() for the LCMS/ImageMagick error detail
- Check the source profile with external tooling and remove/replace it if malformed
- Fall back to encoding without strip for the affected file and alert on it
- Ensure ImageMagick and its LCMS delegate are up to date
Example fix
// before
$encoded = $image->encode(new HeicEncoder(quality: 80, strip: true));
// after
try {
$encoded = $image->encode(new HeicEncoder(quality: 80, strip: true));
} catch (ModifierException $e) {
$reason = $e->getPrevious()?->getMessage() ?? $e->getMessage();
throw new RuntimeException("ICC profile re-apply failed: {$reason}", 0, $e);
} Defensive patterns
Strategy: try-catch
Try / catch
use Intervention\Image\Exceptions\ModifierException;
try {
$encoded = $image->encode(new HeicEncoder(quality: 80, strip: true));
} catch (ModifierException $e) {
$reason = $e->getPrevious()?->getMessage() ?? $e->getMessage();
throw new RuntimeException("ICC re-apply failed: {$reason}", 0, $e);
} Prevention
- Reject or sanitize uploads whose ICC profile fails 'identify -verbose' checks
- Alert on recurring profile failures - they indicate a specific producer/tool in your input stream
When it happens
Trigger: $image->encode(new HeicEncoder(strip: true)) or any Imagick encoder with strip: true when profileImage() throws - invalid profile blob rejected by LCMS, memory limits, or wand invalidated by the preceding strip operation.
Common situations: Corrupt or non-conformant ICC profiles embedded in user uploads; processing pipelines that assume profiles are always valid; ImageMagick builds where LCMS validation is strict.
Related errors
- Failed to apply {class}, unable to re-apply icc profile
- 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/d3378c8df856b31e.
Report an issue: GitHub.