HSL Range
This rule checks that the HSL values of pixels in an image fall within specified ranges for Hue, Saturation, and Lightness.
Parameter table
param | unit | required | description |
---|---|---|---|
minHue | ° | no | Minimum hue value in degrees (minHue ). |
maxHue | ° | no | Maximum hue value in degrees (maxHue ). |
minSaturation | % | no | Minimum saturation value in percentage (minSaturation ). |
maxSaturation | % | no | Maximum saturation value in percentage (maxSaturation ). |
minLightness | % | no | Minimum lightness value in percentage (minLightness ). |
maxLightness | % | no | Maximum lightness value in percentage (maxLightness ). |
Detailed description
HSL stands for Hue, Saturation, and Lightness, and it is a color model used in computer graphics, design, and image editing.
-
Hue Check:
- Ensures that all colors in the image fall within the specified hue range ([
minHue
,maxHue
]) in degrees. - Black, white, and gray colors are exempt from this hue check.
- Ensures that all colors in the image fall within the specified hue range ([
-
Saturation Check:
- Calculates the average saturation value across the entire image.
- Validates that the average saturation is within the specified range ([
minSaturation
,maxSaturation
]) in percentage.
-
Lightness Check:
- Calculates the average lightness value across the entire image.
- Validates that the average lightness is within the specified range ([
minLightness
,maxLightness
]) in percentage.
Correction
The correction process proposes a maximum of two alternatives:
Hue Correction:
- Redistribution of Hue:
- The first proposal redistributes hues to fit within the specified hue range.
- This aims to maintain the original color diversity.
- Gray Replacement:
- The second proposal replaces colors outside the specified hue range with grayscale tones.
- This ensures compliance with the specified hue constraints, with a focus on areas that do not comply with the specified hue constraints.
Saturation and Lightness Correction:
- For both saturation and lightness, the correction adjusts the average value to fall within the specified range.
How to setup
This rule evaluates whether an image's HSL values conform to specified constraints. Key parameters include:
minHue
: Minimum hue value in degrees.maxHue
: Maximum hue value in degrees.minSaturation
: Minimum saturation value in percentage.maxSaturation
: Maximum saturation value in percentage.minLightness
: Minimum lightness value in percentage.maxLightness
: Maximum lightness value in percentage.
All parameters are optional, but at least one is expected.
Creator tips
- Analyze the image's HSL values to understand the distribution of colors.
- Utilize image editing tools to adjust hue, saturation, and lightness.
Examples
value | valid | maxHue | minHue | minLightness | minSaturation | description |
---|---|---|---|---|---|---|
✅ | 30 | -30 | The image should be made up of shades of red only. | |||
❌ | 30 | -30 | The image should be made up of shades of red only. | |||
✅ | 40 | 80 | The image should be made up of flashy colors. |