{"record":{"id":"4618f6ccf4de2fbf","repo":"Intervention/image","slug":"failed-to-apply-intervention-image-drivers-imagick-4618f6","errorCode":null,"errorMessage":"Failed to apply Intervention\\Image\\Drivers\\Imagick\\Modifiers\\CropModifier, unable to create new frame canvas","messagePattern":"Failed to apply Intervention\\\\Image\\\\Drivers\\\\Imagick\\\\Modifiers\\\\CropModifier, unable to create new frame canvas","errorType":"exception","errorClass":"ModifierException","httpStatus":null,"severity":"error","filePath":"src/Drivers/Imagick/Modifiers/CropModifier.php","lineNumber":69,"sourceCode":"            ($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 {\n                $canvas = new Imagick();\n                $canvas->newImage($crop->width(), $crop->height(), $background, 'png');\n                $canvas->setImageResolution($resolution->x(), $resolution->y());\n                $canvas->setImageAlphaChannel(Imagick::ALPHACHANNEL_SET); // or ALPHACHANNEL_ACTIVATE?\n                $canvas->setImageColorspace(match ($image->colorspace()::class) {\n                    Cmyk::class => Imagick::COLORSPACE_CMYK,\n                    Hsv::class => Imagick::COLORSPACE_HSB,\n                    Hsl::class => Imagick::COLORSPACE_HSL,\n                    default => Imagick::COLORSPACE_SRGB,\n                });\n            } catch (ImagickException $e) {\n                throw new ModifierException(\n                    'Failed to apply ' . self::class . ', unable to create new frame canvas',\n                    previous: $e,\n                );\n            }\n\n            // set animation details\n            if ($image->isAnimated()) {\n                try {\n                    $canvas->setImageDelay($frame->native()->getImageDelay());\n                    $canvas->setImageIterations($frame->native()->getImageIterations());\n                    $canvas->setImageDispose($frame->native()->getImageDispose());\n                } catch (ImagickException $e) {\n                    throw new ModifierException(\n                        'Failed to apply ' . self::class . ', unable to set animation details',\n                        previous: $e,\n                    );\n                }\n            }","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/Intervention/image/blob/5598b9e39751c34afc5cdee84abef77f92c26f68/src/Drivers/Imagick/Modifiers/CropModifier.php#L51-L87","documentation":"Error \"Failed to apply Intervention\\Image\\Drivers\\Imagick\\Modifiers\\CropModifier, unable to create new frame canvas\" thrown in Intervention/image.","triggerScenarios":"Thrown at src/Drivers/Imagick/Modifiers/CropModifier.php:69 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the computed crop rectangle has a width and height of at least 1 pixel; coordinates outside the image can produce an empty canvas","Validate the crop offset (x, y) combined with width/height so the resulting frame is not degenerate","Confirm the source frame's Imagick instance is valid before creating the new frame canvas"],"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"}