Intervention/image · error · ModifierException

Failed to apply Intervention\Image\Drivers\Imagick\Modifiers

Error message

Failed to apply Intervention\Image\Drivers\Imagick\Modifiers\DrawLineModifier, unable to build ImagickDraw object

What it means

Error "Failed to apply Intervention\Image\Drivers\Imagick\Modifiers\DrawLineModifier, unable to build ImagickDraw object" thrown in Intervention/image.

Source

Thrown at src/Drivers/Imagick/Modifiers/DrawLineModifier.php:66

        try {
            $drawing = new ImagickDraw();
            $drawing->setStrokeWidth($this->drawable->width());
            $drawing->setFillOpacity(0);

            if ($this->drawable->hasBackgroundColor()) {
                $drawing->setStrokeColor($color);
            }

            $drawing->line(
                $this->drawable->start()->x(),
                $this->drawable->start()->y(),
                $this->drawable->end()->x(),
                $this->drawable->end()->y(),
            );

            return $drawing;
        } catch (ImagickException | ImagickDrawException $e) {
            throw new ModifierException(
                'Failed to apply ' . self::class . ', unable to build ImagickDraw object',
                previous: $e,
            );
        }
    }
}

View on GitHub (pinned to 5598b9e397)

Solutions

  1. Ensure the line has valid start and end Point objects with numeric coordinates
  2. Check that the stroke color and stroke width passed to the line are valid (width >= 0, parseable color)
  3. Verify the imagick extension can instantiate \ImagickDraw (extension loaded, version compatible)

When it happens

Trigger: Thrown at src/Drivers/Imagick/Modifiers/DrawLineModifier.php:66 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/815aae0023c3b726. Report an issue: GitHub.