{"record":{"id":"6bc1706554a2555b","repo":"Intervention/image","slug":"color-profiles-are-not-supported-by-gd-driver","errorCode":null,"errorMessage":"Color profiles are not supported by GD driver","messagePattern":"Color profiles are not supported by GD driver","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/Drivers/Gd/Modifiers/ProfileModifier.php","lineNumber":23,"sourceCode":"namespace Intervention\\Image\\Drivers\\Gd\\Modifiers;\n\nuse Intervention\\Image\\Exceptions\\NotSupportedException;\nuse Intervention\\Image\\Interfaces\\ImageInterface;\nuse Intervention\\Image\\Interfaces\\SpecializedInterface;\nuse Intervention\\Image\\Modifiers\\ProfileModifier as GenericProfileModifier;\n\nclass ProfileModifier extends GenericProfileModifier implements SpecializedInterface\n{\n    /**\n     * {@inheritdoc}\n     *\n     * @see ModifierInterface::apply()\n     *\n     * @throws NotSupportedException\n     */\n    public function apply(ImageInterface $image): ImageInterface\n    {\n        throw new NotSupportedException(\n            'Color profiles are not supported by GD driver',\n        );\n    }\n}\n","sourceCodeStart":5,"sourceCodeEnd":28,"githubUrl":"https://github.com/Intervention/image/blob/5598b9e39751c34afc5cdee84abef77f92c26f68/src/Drivers/Gd/Modifiers/ProfileModifier.php#L5-L28","documentation":"The GD driver has no ICC color profile support at all - libgd contains no colorspace management. The specialized ProfileModifier therefore does nothing but throw NotSupportedException the moment it is applied (via $image->setProfile()), regardless of input. This is a hard capability gap rather than a runtime failure: with the GD driver, profile operations can never succeed; the Imagick driver implements them natively.","triggerScenarios":"Calling $image->setProfile($profile) on an image created by a manager built with Intervention\\Image\\Drivers\\Gd\\Driver; portable pipelines that run the same code under both drivers; automated color-management steps that assume Imagick features exist everywhere.","commonSituations":"Production hosts that only offer ext-gd; migrating a working Imagick pipeline to GD for deployment; trying to embed sRGB profiles into uploads on shared hosting.","solutions":["Switch the manager to the Imagick driver when profile support is required (ext-imagick must be installed)","Gate the call: skip profile operations when the active driver is GD","Handle ICC profiles outside the library (exiftool, pel) on the encoded file before/after processing","Catch NotSupportedException and continue without profile embedding"],"exampleFix":"// before\n$manager = new ImageManager(GdDriver::class);\n$image = $manager->decode('photo.jpg')->setProfile($profile); // NotSupportedException\n\n// after\nuse Intervention\\Image\\Drivers\\Imagick\\Driver as ImagickDriver;\n$manager = new ImageManager(ImagickDriver::class);\n$image = $manager->decode('photo.jpg')->setProfile($profile);","handlingStrategy":"type-guard","validationCode":"use Intervention\\Image\\Drivers\\Gd\\Driver as GdDriver;\n\n// you control the driver at construction time - decide there\n$manager = new ImageManager(ImagickDriver::class);\n$driverSupportsProfiles = !$manager->driver instanceof GdDriver;\n\nif ($driverSupportsProfiles) {\n    $image->setProfile($profile);\n}","typeGuard":"use Intervention\\Image\\Drivers\\Gd\\Driver as GdDriver;\nuse Intervention\\Image\\Interfaces\\DriverInterface;\n\nfunction supportsColorProfiles(DriverInterface $driver): bool\n{\n    return !$driver instanceof GdDriver;\n}","tryCatchPattern":"use Intervention\\Image\\Exceptions\\NotSupportedException;\n\ntry {\n    $image->setProfile($profile);\n} catch (NotSupportedException $e) {\n    // GD cannot manage ICC profiles; continue without embedding\n    $logger->info('Skipped profile embedding: ' . $e->getMessage());\n}","preventionTips":["Decide the driver based on required features: profiles need Imagick.","Centralize driver selection in one factory so capability checks are easy.","Assert required extensions (ext-imagick) at boot, not at image time."],"tags":["gd","icc","color-profile","driver","not-supported"],"backgroundTag":"unsupported-driver-feature","analyzedSha":"5598b9e39751c34afc5cdee84abef77f92c26f68","analyzedAt":"2026-08-23T02:17:31.068Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}