Skip to main content

Max Color Count

This rule checks that the image does not exceed the specified maximum number of colors.

Parameter table

paramunitrequireddescription
maxColorCountCountnoMaximum number of colors allowed in the image (maxColorCount).

Detailed description

This rule checks that the image does not exceed a specified maximum number of colors.The checking process involves iterating through the pixels of the image to count unique colors.The validation ensures that the count does not exceed the specified maximum color count.

Correction

The correction process involves color quantization using the K-means algorithm with K equal to the specified maximum color count. The image is transformed by reducing the number of distinct colors while preserving visual quality.

How to setup

This rule evaluates whether an image's color count conforms to the specified maximum limit. The only parameter is:

  • maxColorCount: Maximum number of colors allowed in the image.

Creator tips

To reduce the number of colors with greater flexibility, consider the following resources:

Examples

valuevalidmaxColorCountdescription
Mario & Luigi16The image should have a maximum of 16 colors.
Mario16The image should have a maximum of 16 colors.