Intervention/image · error · NotSupportedException

Target colorspace "{target}" is not supported by driver

Error message

Target colorspace "{target}" is not supported by driver

What it means

Error "Target colorspace "{target}" is not supported by driver" thrown in Intervention/image.

Source

Thrown at src/Modifiers/ColorspaceModifier.php:39

        //
    }

    /**
     * Build the target color space.
     *
     * @throws NotSupportedException
     */
    protected function targetColorspace(): ColorspaceInterface
    {
        if ($this->target instanceof ColorspaceInterface) {
            return $this->target;
        }

        if (class_exists($this->target)) {
            $colorspace = new $this->target();

            if (!$colorspace instanceof ColorspaceInterface) {
                throw new NotSupportedException(
                    'Target colorspace "' . $this->target . '" is not supported by driver',
                );
            }

            return $colorspace;
        }

        return match (strtolower($this->target)) {
            'rgb', 'srgb', 'rgba', 'srgba' => new Rgb(),
            'cmyk' => new Cmyk(),
            'hsl' => new Hsl(),
            'hsv', 'hsb' => new Hsv(),
            'oklab' => new Oklab(),
            'oklch' => new Oklch(),
            default => throw new NotSupportedException(
                'Colorspace is not supported by driver',
            ),
        };

View on GitHub (pinned to 5598b9e397)

Solutions

  1. Use a colorspace supported by your driver, e.g. Intervention\Image\Colors\Rgb\Colorspace::class for GD
  2. Check DriverInterface::supports() or driver()->colorSpaces() (driver capabilities) before calling setColorspace()
  3. Convert via a supported intermediate colorspace if the target is unavailable

When it happens

Trigger: Thrown at src/Modifiers/ColorspaceModifier.php:39 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Intervention/image@5598b9e397 (2026-08-23). Data as JSON: /api/errors/3dc5325f66b39472. Report an issue: GitHub.