Intervention/image · error · InvalidArgumentException

Color level for argument $green must be in range -100 to 100

Error message

Color level for argument $green must be in range -100 to 100

What it means

Error "Color level for argument $green must be in range -100 to 100" thrown in Intervention/image.

Source

Thrown at src/Modifiers/ColorizeModifier.php:27

class ColorizeModifier extends SpecializableModifier
{
    /**
     * Create new modifier object.
     *
     * @throws InvalidArgumentException
     */
    public function __construct(
        public int $red = 0,
        public int $green = 0,
        public int $blue = 0,
    ) {
        if ($red < -100 || $red > 100) {
            throw new InvalidArgumentException('Color level for argument $red must be in range -100 to 100');
        }

        if ($green < -100 || $green > 100) {
            throw new InvalidArgumentException('Color level for argument $green must be in range -100 to 100');
        }

        if ($blue < -100 || $blue > 100) {
            throw new InvalidArgumentException('Color level for argument $blue must be in range -100 to 100');
        }
    }
}

View on GitHub (pinned to 5598b9e397)

Solutions

  1. Pass a green channel level between -100 and 100 to colorize()
  2. Clamp computed values with max(-100, min(100, $green))
  3. Validate form/API input ranges before calling colorize

When it happens

Trigger: Thrown at src/Modifiers/ColorizeModifier.php:27 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/9272e126a7b3217a. Report an issue: GitHub.