Intervention/image · error · ModifierException
Failed to apply Intervention\Image\Drivers\Imagick\Modifiers
Error message
Failed to apply Intervention\Image\Drivers\Imagick\Modifiers\BrightnessModifier, unable to adjust image brightness
What it means
Thrown by the Imagick BrightnessModifier when Imagick::modulateImage(100 + level, 100, 100) returns false during $image->brightness($level). The modifier maps brightness percentage onto modulateImage's first argument; a false return means ImageMagick refused the operation without throwing. No previous exception is attached to this variant.
Source
Thrown at src/Drivers/Imagick/Modifiers/BrightnessModifier.php:24
use ImagickException;
use Intervention\Image\Exceptions\ModifierException;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Modifiers\BrightnessModifier as GenericBrightnessModifier;
class BrightnessModifier extends GenericBrightnessModifier implements SpecializedInterface
{
/**
* @throws ModifierException
*/
public function apply(ImageInterface $image): ImageInterface
{
foreach ($image as $frame) {
try {
$result = $frame->native()->modulateImage(100 + $this->level, 100, 100);
if ($result === false) {
throw new ModifierException(
'Failed to apply ' . self::class . ', unable to adjust image brightness',
);
}
} catch (ImagickException $e) {
throw new ModifierException(
'Failed to apply ' . self::class . ', unable to adjust image brightness',
previous: $e,
);
}
}
return $image;
}
}
View on GitHub (pinned to 5598b9e397)
Solutions
- Check $e->getPrevious() chain and, if absent (false-return path), reproduce via CLI: convert in.png -modulate 130x100x100 out.png to see the environment error.
- Convert the working image to sRGB before brightness: read with the Imagick driver and apply colorspace(RgbColorspace) first.
- Raise ImageMagick resource limits or process a downscaled copy when dimensions are extreme.
- Update ImageMagick/ext-imagick to matching current versions if modulate fails for ordinary RGB inputs.
Example fix
// before $image->brightness(30); // false-return -> ModifierException // after $image->colorspace(\Intervention\Image\Colors\Rgb\Colorspace::class)->brightness(30);
Defensive patterns
Strategy: fallback
Validate before calling
// probe modulate support for this build before relying on brightness()
$probe = new \Imagick();
$probe->newImage(4, 4, new \ImagickPixel('gray'));
$modulateOk = $probe->modulateImage(120, 100, 100) !== false;
$probe->destroy(); Try / catch
use Intervention\Image\Exceptions\ModifierException;
try {
$image->brightness(25);
} catch (ModifierException $e) {
// fallback path: convert to sRGB and retry once
try {
$image->colorspace(\Intervention\Image\Colors\Rgb\Colorspace::class)->brightness(25);
} catch (ModifierException $e2) {
throw $e2;
}
} Prevention
- Normalize inputs to sRGB before brightness adjustments, especially CMYK sources.
- Keep brightness levels in the documented -100..100 spirit; extreme values amplify resource use.
When it happens
Trigger: Calling $image->brightness() with any level (positive or negative — the constructor does not restrict it) on a frame where modulateImage cannot run: degraded wand state, unsupported image type for modulation, or resource exhaustion.
Common situations: Applying brightness adjustments to CMYK or grayscale-source images on ImageMagick versions with incomplete modulate support; batch pipelines on hosts with tight policy.xml limits; reusing images after failed prior operations.
Related errors
- Failed to apply Intervention\Image\Drivers\Imagick\Modifiers
- Failed to apply Intervention\Image\Drivers\Imagick\Modifiers
- Failed to apply Intervention\Image\Drivers\Imagick\Modifiers
- Failed to apply Intervention\Image\Drivers\Imagick\Modifiers
- Failed to convert colorspace to Imagick constant
AI-assisted analysis of Intervention/image@5598b9e397 (2026-08-23).
Data as JSON: /api/errors/da2b6f10f8849613.
Report an issue: GitHub.