Intervention/image · error · ModifierException

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

Error message

Failed to apply Intervention\Image\Drivers\Imagick\Modifiers\CropModifier, unable to create new imagick instance

What it means

Error "Failed to apply Intervention\Image\Drivers\Imagick\Modifiers\CropModifier, unable to create new imagick instance" thrown in Intervention/image.

Source

Thrown at src/Drivers/Imagick/Modifiers/CropModifier.php:39

class CropModifier extends GenericCropModifier implements SpecializedInterface
{
    /**
     * @throws InvalidArgumentException
     * @throws ModifierException
     * @throws StateException
     */
    public function apply(ImageInterface $image): ImageInterface
    {
        // decode background color
        $background = $this->driver()->colorProcessor($image)->export(
            $this->backgroundColor(),
        );

        try {
            // create empty container imagick to rebuild core
            $imagick = new Imagick();
        } catch (ImagickException $e) {
            throw new ModifierException(
                'Failed to apply ' . self::class . ', unable to create new imagick instance',
                previous: $e,
            );
        }

        // save resolution to add it later
        $resolution = $image->resolution()->perInch();

        // define position of the image on the new canvas
        $crop = $this->crop($image);
        $position = [
            ($crop->pivot()->x() + $this->x) * -1,
            ($crop->pivot()->y() + $this->y) * -1,
        ];

        foreach ($image as $frame) {
            // create new frame canvas with modifiers background
            try {

View on GitHub (pinned to 5598b9e397)

Solutions

  1. Verify the Imagick PHP extension is loaded (extension_loaded('imagick'))
  2. Make sure the image being cropped was decoded successfully and its core contains a valid Imagick object
  3. Check Imagick version compatibility when cloning image instances, e.g. by upgrading imagick/PHP if the clone call fails

When it happens

Trigger: Thrown at src/Drivers/Imagick/Modifiers/CropModifier.php:39 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/2773ccc55bdebf5c. Report an issue: GitHub.