{"record":{"id":"b581521be946a624","repo":"Intervention/image","slug":"failed-to-apply-class-unable-to-re-apply-icc-pr","errorCode":null,"errorMessage":"Failed to apply {class}, unable to re-apply icc profile","messagePattern":"Failed to apply (.+?), unable to re-apply icc profile","errorType":"exception","errorClass":"Intervention\\Image\\Exceptions\\ModifierException","httpStatus":null,"severity":"error","filePath":"src/Drivers/Imagick/Modifiers/StripMetaModifier.php","lineNumber":57,"sourceCode":"                throw new ModifierException(\n                    'Failed to apply ' . self::class . ', unable to strip meta data',\n                );\n            }\n        } catch (ImagickException $e) {\n            throw new ModifierException(\n                'Failed to apply ' . self::class . ', unable to strip meta data',\n                previous: $e,\n            );\n        }\n\n        $image->setExif(new Collection());\n\n        if ($profiles !== []) {\n            // re-apply icc profiles\n            try {\n                $result = $image->core()->native()->profileImage(\"icc\", $profiles['icc']);\n                if ($result === false) {\n                    throw new ModifierException(\n                        'Failed to apply ' . self::class . ', unable to re-apply icc profile',\n                    );\n                }\n            } catch (ImagickException $e) {\n                throw new ModifierException(\n                    'Failed to apply ' . self::class . ', unable to re-apply icc profile',\n                    previous: $e,\n                );\n            }\n        }\n        return $image;\n    }\n}\n","sourceCodeStart":39,"sourceCodeEnd":71,"githubUrl":"https://github.com/Intervention/image/blob/5598b9e39751c34afc5cdee84abef77f92c26f68/src/Drivers/Imagick/Modifiers/StripMetaModifier.php#L39-L71","documentation":"Final failure step of the Imagick StripMetaModifier: metadata was stripped, and re-applying the preserved ICC profile via Imagick::profileImage('icc', $profiles['icc']) returned false. The image is caught mid-pipeline - stripped but without its color profile - so the modifier aborts instead of silently delivering an untagged image.","triggerScenarios":"$image->encode(new WebpEncoder(strip: true)) or similar when the previously saved ICC blob cannot be re-attached: malformed or truncated profile, a profile ImageMagick's LCMS rejects, or a format whose wand state changed after stripImage().","commonSituations":"Sources with broken or non-standard ICC profiles (common in files from obscure editors/scanners); mixing color profiles across re-encodes; ImageMagick without proper LCMS support failing validation of the blob.","solutions":["Inspect getPrevious() and test the source file with 'identify -verbose' to see if its ICC profile is malformed","Skip profile preservation by stripping the profile externally before processing","Re-encode without strip: true for the affected files","Verify LCMS delegate support in the ImageMagick build"],"exampleFix":"// before\n$encoded = $image->encode(new WebpEncoder(quality: 85, strip: true));\n\n// after\ntry {\n    $encoded = $image->encode(new WebpEncoder(quality: 85, strip: true));\n} catch (ModifierException $e) {\n    $logger->warning('ICC re-apply failed: ' . $e->getMessage());\n    $encoded = $image->encode(new WebpEncoder(quality: 85));\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"use Intervention\\Image\\Exceptions\\ModifierException;\n\ntry {\n    $encoded = $image->encode(new WebpEncoder(quality: 85, strip: true));\n} catch (ModifierException $e) {\n    $logger->warning('Could not re-attach ICC profile: ' . $e->getMessage());\n    $encoded = $image->encode(new WebpEncoder(quality: 85));\n}","preventionTips":["Validate or strip ICC profiles at upload time for untrusted files","Keep LCMS delegate present and current in the ImageMagick build"],"tags":["imagick","icc-profile","color-profile","strip","encoding"],"backgroundTag":"imagick-operation-failed","analyzedSha":"5598b9e39751c34afc5cdee84abef77f92c26f68","analyzedAt":"2026-08-23T02:17:31.068Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}