{"record":{"id":"2773ccc55bdebf5c","repo":"Intervention/image","slug":"failed-to-apply-intervention-image-drivers-imagick-2773cc","errorCode":null,"errorMessage":"Failed to apply Intervention\\Image\\Drivers\\Imagick\\Modifiers\\CropModifier, unable to create new imagick instance","messagePattern":"Failed to apply Intervention\\\\Image\\\\Drivers\\\\Imagick\\\\Modifiers\\\\CropModifier, unable to create new imagick instance","errorType":"exception","errorClass":"ModifierException","httpStatus":null,"severity":"error","filePath":"src/Drivers/Imagick/Modifiers/CropModifier.php","lineNumber":39,"sourceCode":"class CropModifier extends GenericCropModifier implements SpecializedInterface\n{\n    /**\n     * @throws InvalidArgumentException\n     * @throws ModifierException\n     * @throws StateException\n     */\n    public function apply(ImageInterface $image): ImageInterface\n    {\n        // decode background color\n        $background = $this->driver()->colorProcessor($image)->export(\n            $this->backgroundColor(),\n        );\n\n        try {\n            // create empty container imagick to rebuild core\n            $imagick = new Imagick();\n        } catch (ImagickException $e) {\n            throw new ModifierException(\n                'Failed to apply ' . self::class . ', unable to create new imagick instance',\n                previous: $e,\n            );\n        }\n\n        // save resolution to add it later\n        $resolution = $image->resolution()->perInch();\n\n        // define position of the image on the new canvas\n        $crop = $this->crop($image);\n        $position = [\n            ($crop->pivot()->x() + $this->x) * -1,\n            ($crop->pivot()->y() + $this->y) * -1,\n        ];\n\n        foreach ($image as $frame) {\n            // create new frame canvas with modifiers background\n            try {","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/Intervention/image/blob/5598b9e39751c34afc5cdee84abef77f92c26f68/src/Drivers/Imagick/Modifiers/CropModifier.php#L21-L57","documentation":"Error \"Failed to apply Intervention\\Image\\Drivers\\Imagick\\Modifiers\\CropModifier, unable to create new imagick instance\" thrown in Intervention/image.","triggerScenarios":"Thrown at src/Drivers/Imagick/Modifiers/CropModifier.php:39 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the Imagick PHP extension is loaded (extension_loaded('imagick'))","Make sure the image being cropped was decoded successfully and its core contains a valid Imagick object","Check Imagick version compatibility when cloning image instances, e.g. by upgrading imagick/PHP if the clone call fails"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5598b9e39751c34afc5cdee84abef77f92c26f68","analyzedAt":"2026-08-23T02:17:31.068Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}