Intervention/image · error · ModifierException
Failed to apply Intervention\Image\Drivers\Imagick\Modifiers
Error message
Failed to apply Intervention\Image\Drivers\Imagick\Modifiers\ContrastModifier, unable to adjust image contrast
What it means
Error "Failed to apply Intervention\Image\Drivers\Imagick\Modifiers\ContrastModifier, unable to adjust image contrast" thrown in Intervention/image.
Source
Thrown at src/Drivers/Imagick/Modifiers/ContrastModifier.php:33
{
/**
* @throws ModifierException
*/
public function apply(ImageInterface $image): ImageInterface
{
// sigmoidalContrastImage's midpoint argument is in QuantumRange units,
// not the [0..1] range a normalized API would imply. Passing 0 pivots
// the sigmoidal curve around pure black, which lifts every pixel
// including the midtone — the opposite of a symmetric contrast
// adjustment. Pivot around the middle of the QuantumRange so a
// mid-grey pixel survives unchanged and the curve is symmetric.
$midpoint = Imagick::QUANTUM_RANGE / 2;
foreach ($image as $frame) {
try {
$result = $frame->native()->sigmoidalContrastImage($this->level > 0, abs($this->level / 4), $midpoint);
if ($result === false) {
throw new ModifierException(
'Failed to apply ' . self::class . ', unable to adjust image contrast',
);
}
} catch (ImagickException $e) {
throw new ModifierException(
'Failed to apply ' . self::class . ', unable to adjust image contrast',
previous: $e,
);
}
}
return $image;
}
}
View on GitHub (pinned to 5598b9e397)
Solutions
- Pass a contrast level as an integer between -100 and 100
- Make sure the image was successfully decoded before calling contrast(), since the modifier operates on every frame of the Imagick instance
- Verify the Imagick extension is installed and its version supports contrastImage
When it happens
Trigger: Thrown at src/Drivers/Imagick/Modifiers/ContrastModifier.php:33 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Intervention/image@5598b9e397 (2026-08-23).
Data as JSON: /api/errors/4cd1a4232d0be419.
Report an issue: GitHub.