Size Range
This rule checks that an image has both a width and a height within the specified range (in pixels).
Parameter table
param | unit | required | description |
---|---|---|---|
minWidth | px | no | The minimum width of the image in pixels (minWidth ). |
maxWidth | px | no | The maximum width of the image in pixels (maxWidth ). |
minHeight | px | no | The minimum height of the image in pixels (minHeight ). |
maxHeight | px | no | The maximum height of the image in pixels (maxHeight ). |
Correction
The correction process proposes a maximum of two alternatives:
- First Proposal (Maintaining Original Ratio):
- If feasible, the first proposal aims to retain the same aspect ratio as the original image while fitting within the specified dimensions.
- In some cases, maintaining the original ratio may not be possible while adhering to the given constraints.
- Second Proposal (Non-Original Ratio):
- The second proposal does not necessarily maintain the original aspect ratio.
- Priority for each dimension (width or height) is determined in the following order:
- The original dimension (if within the specified interval).
- The minimum dimension (minWidth, minHeight) if provided.
- The maximum dimension (maxWidth, maxHeight).
The correction process ensures that at most two proposals are generated, considering the specified constraints.
How to setup
This rule evaluates whether an image's dimensions adhere to specified size constraints. Key parameters include:
minWidth
: Minimum width of the image in pixels.maxWidth
: Maximum width of the image in pixels.minHeight
: Minimum height of the image in pixels.maxHeight
: Maximum height of the image in pixels.
All arguments are optional, but at least one is expected.
Creator tips
- You can investigate the image size by simply checking its properties.
- You can resize images with simple image editing tools like paint.
Examples
value | valid | maxHeight | maxWidth | minHeight | minWidth | description |
---|---|---|---|---|---|---|
✅ | 512 | 512 | 32 | 32 | The image size should be [32, 512]x[32, 512]. | |
❌ | 64 | The image maximum height should be 64px. |