Intervention/image · error · InvalidArgumentException

Invalid pixelation size. Must be int<1, max>

Error message

Invalid pixelation size. Must be int<1, max>

What it means

Error "Invalid pixelation size. Must be int<1, max>" thrown in Intervention/image.

Source

Thrown at src/Modifiers/PixelateModifier.php:18

<?php

declare(strict_types=1);

namespace Intervention\Image\Modifiers;

use Intervention\Image\Drivers\SpecializableModifier;
use Intervention\Image\Exceptions\InvalidArgumentException;

class PixelateModifier extends SpecializableModifier
{
    /**
     * @throws InvalidArgumentException
     */
    public function __construct(public int $size)
    {
        if ($this->size < 1) {
            throw new InvalidArgumentException('Invalid pixelation size. Must be int<1, max>');
        }
    }
}

View on GitHub (pinned to 5598b9e397)

Solutions

  1. Pass an integer pixel size of at least 1 to pixelate()
  2. Clamp computed sizes: max(1, (int) $size)
  3. Validate user input so 0 or negative sizes are rejected

When it happens

Trigger: Thrown at src/Modifiers/PixelateModifier.php:18 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/69fae8051c98c1b4. Report an issue: GitHub.