{"record":{"id":"8dfda52850e2c470","repo":"Intervention/image","slug":"failed-to-apply-intervention-image-drivers-imagick","errorCode":null,"errorMessage":"Failed to apply Intervention\\Image\\Drivers\\Imagick\\Modifiers\\BlurModifier, unable to blur image","messagePattern":"Failed to apply Intervention\\\\Image\\\\Drivers\\\\Imagick\\\\Modifiers\\\\BlurModifier, unable to blur image","errorType":"exception","errorClass":"ModifierException","httpStatus":null,"severity":"error","filePath":"src/Drivers/Imagick/Modifiers/BlurModifier.php","lineNumber":24,"sourceCode":"\nuse ImagickException;\nuse Intervention\\Image\\Exceptions\\ModifierException;\nuse Intervention\\Image\\Interfaces\\ImageInterface;\nuse Intervention\\Image\\Interfaces\\SpecializedInterface;\nuse Intervention\\Image\\Modifiers\\BlurModifier as GenericBlurModifier;\n\nclass BlurModifier extends GenericBlurModifier implements SpecializedInterface\n{\n    /**\n     * @throws ModifierException\n     */\n    public function apply(ImageInterface $image): ImageInterface\n    {\n        foreach ($image as $frame) {\n            try {\n                $result = $frame->native()->blurImage($this->level, 0.5 * $this->level);\n                if ($result === false) {\n                    throw new ModifierException(\n                        'Failed to apply ' . self::class . ', unable to blur image',\n                    );\n                }\n            } catch (ImagickException $e) {\n                throw new ModifierException(\n                    'Failed to apply ' . self::class . ', unable to blur image',\n                    previous: $e,\n                );\n            }\n        }\n\n        return $image;\n    }\n}\n","sourceCodeStart":6,"sourceCodeEnd":39,"githubUrl":"https://github.com/Intervention/image/blob/5598b9e39751c34afc5cdee84abef77f92c26f68/src/Drivers/Imagick/Modifiers/BlurModifier.php#L6-L39","documentation":"Thrown by the Imagick BlurModifier when Imagick::blurImage() returns false instead of throwing, i.e. ImageMagick reports failure through its return code. It surfaces from $image->blur($level) and wraps a ModifierException with no previous exception, since the native API only said 'false'. The modifier runs per frame, so animated images fail on the first bad frame.","triggerScenarios":"Calling $image->blur() when the ImageMagick install cannot execute the Gaussian blur for this image state (degraded wand, unsupported colorspace for the operation, exhausted resources). Level is already validated as >= 0 by the generic constructor, so the failure is environmental, not argument-related.","commonSituations":"ImageMagick resource limits (area/memory policy.xml caps) hit on large images; CMYK or 16-bit images on old ImageMagick versions whose blur path fails; container images built without proper ImageMagick delegates; intermittent failures in high-throughput workers under memory pressure.","solutions":["Check image dimensions and raise ImageMagick resource limits (policy.xml or Imagick::setResourceLimit) — large blurs are memory-heavy.","Convert the image to RGB before blurring: $image = $manager->read($path); consider colorspace conversion first if the source is CMYK/16-bit.","Reproduce with the CLI (convert input.png -blur 0x5 /dev/null) to confirm it is an ImageMagick environment issue, then fix the install (delegates, version).","Fall back to the GD driver if the environment cannot be repaired: new ImageManager(new Driver()) with Intervention\\Image\\Drivers\\Gd\\Driver."],"exampleFix":"// before\n$image->blur(15); // ModifierException on resource-starved host\n\n// after\n\\Imagick::setResourceLimit(\\Imagick::RESOURCETYPE_MEMORY, 256 * 1024 * 1024);\n\\Imagick::setResourceLimit(\\Imagick::RESOURCETYPE_AREA, 256 * 1024 * 1024);\n$image->blur(15);","handlingStrategy":"fallback","validationCode":"// pre-flight: confirm the operation is feasible on this environment\n$probe = new \\Imagick();\n$probe->newImage(4, 4, new \\ImagickPixel('red'));\n$blurOk = $probe->blurImage(2, 1) !== false;\n$probe->destroy();","typeGuard":null,"tryCatchPattern":"use Intervention\\Image\\Exceptions\\ModifierException;\ntry {\n    $image->blur(12);\n} catch (ModifierException $e) {\n    // fallback: retry once on a downscaled copy, or route to the GD driver\n    $image = $manager->read($source)->scaleDown(1200, 1200)->blur(12);\n}","preventionTips":["Size ImageMagick resource limits to your largest image before deploying filter pipelines.","Convert CMYK/16-bit sources to sRGB first; blur is most reliable in 8-bit RGB.","Wrap $image->blur() in job-level error handling so one bad image does not kill a queue worker."],"tags":["imagick","blur","filter","modifier-exception","resources"],"backgroundTag":"image-modifier-failed","analyzedSha":"5598b9e39751c34afc5cdee84abef77f92c26f68","analyzedAt":"2026-08-23T02:17:31.068Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}