By Tarkashilpa
A Strapi plugin that validates images uploaded through Media fields based on aspect ratio and minimum width. Configure image requirements directly in the Strapi Admin Panel and help content editors select images that meet the requirements of your website.
released September 1, 2026
npm install @tarkashilpa/strapi-plugin-image-dimension-validationA Strapi plugin that validates images uploaded through Media fields based on aspect ratio and minimum width.
Configure image requirements directly in the Strapi Admin Panel and help content editors select images that meet the requirements of your website.

When an invalid image is selected, a validation error is displayed as shown below:

Different sections of a website often require images with specific proportions and resolutions.
For example:
16:9, minimum width 2048px4:3, minimum width 1600px1:1, minimum width 1200pxStrapi Image Validation allows developers to configure these requirements directly on individual Media fields.
Validation of image dimensions and resolution on the Strapi level prevents:
I’d update it to distinguish supported Strapi versions from the recommended Node.js versions:
| Requirement | Supported Version |
|---|---|
| Strapi | 5.0.0 and up |
| Node.js | 18.x and up |
To verify compatibility, the plugin has been tested against the following Strapi and Node.js configurations:
| Strapi Version | Node.js Version | Status |
|---|---|---|
5.0.0 | 18.x | ✅ Tested |
5.0.0 | 20.x | ✅ Tested |
5.31.0 | 20.x | ✅ Tested |
5.31.0 | 22.x | ✅ Tested |
5.31.0 | 24.x | ✅ Tested |
5.48.1 | 22.x | ✅ Tested |
5.48.1 | 24.x | ✅ Tested |
These configurations were strategically selected based on Strapi and Node.js compatibility boundaries to provide coverage across different Strapi and Node.js versions.
Install the plugin in your Strapi project:
npm install strapi-plugin-image-validationAfter installation, rebuild the Strapi Admin Panel:
npm run buildThen start Strapi:
npm run developImage validation is configured independently for each Media field.
Navigate to:
Content-Type Builder
→ Select a Content Type
→ Select a Media Field
→ Advanced Settings
→ Image Validation
Each validation rule contains:
| Setting | Description |
|---|---|
| Aspect Ratio | The required width-to-height ratio of the image |
| Minimum Width | The minimum width of the image in pixels |
For example:
Aspect Ratio: 16:9
Minimum Width: 2048pxThis means the image must have a 16:9 aspect ratio and a width of at least 2048px.
The validation configuration is stored as part of the Media field configuration.
{
"imageValidation": {
"rules": [
{
"aspectRatio": {
"width": 16,
"height": 9
},
"minWidth": 2048
}
]
}
}The configuration above requires:
Aspect Ratio: 16:9
Minimum Width: 2048pxA Media field can support multiple valid image formats.
For example:
{
"imageValidation": {
"rules": [
{
"aspectRatio": {
"width": 16,
"height": 9
},
"minWidth": 2048
},
{
"aspectRatio": {
"width": 4,
"height": 3
},
"minWidth": 1600
},
{
"aspectRatio": {
"width": 1,
"height": 1
},
"minWidth": 1200
}
]
}
}In this example, the Media field accepts an image when it satisfies at least one of the configured rules.
The validation logic is:
Rule 1
OR
Rule 2
OR
Rule 3Each individual rule requires both conditions to be satisfied:
Aspect Ratio
AND
Minimum WidthFor example:
16:9 + minimum width 2048pxis one complete validation rule.
The minimum width is configured independently for each aspect ratio.
For example:
16:9 → Minimum Width: 2048px
4:3 → Minimum Width: 1600px
1:1 → Minimum Width: 1200pxAn image only needs to satisfy the minimum width associated with the rule it matches.
For example:
Rule 1
16:9
Minimum Width: 2048px
Rule 2
4:3
Minimum Width: 1600pxA 4:3 image with a width of 1600px can pass Rule 2 without needing to meet the 2048px minimum defined for Rule 1.
Aspect ratio validation uses a fixed tolerance of:
0.02This allows small variations when comparing the actual aspect ratio of an image with the configured aspect ratio.
The tolerance is currently fixed and cannot be configured.
Once image validation has been configured for a Media field, images selected for that field are checked against the configured validation rules.
An image is considered valid when:
For the following rule:
Aspect Ratio: 16:9
Minimum Width: 2048pxThe following images are valid:
2048 × 1152 ✓
2560 × 1440 ✓
3840 × 2160 ✓Higher-resolution images with the same aspect ratio are also accepted.
An image with the correct aspect ratio but insufficient width is invalid:
1920 × 1080 ✗The aspect ratio is correct, but the width is below 2048px.
An image with sufficient width but an incorrect aspect ratio is also invalid:
2048 × 1536 ✗The width requirement is satisfied, but the image does not match the configured 16:9 aspect ratio within the allowed tolerance.
Aspect Ratio: 16:9
Minimum Width: 2048pxUseful for large website sections where a high-resolution, wide image is required.
Aspect Ratio: 4:3
Minimum Width: 1600pxUseful for maintaining consistent image proportions across card layouts.
Aspect Ratio: 1:1
Minimum Width: 1200pxUseful for promotional tiles, square content blocks, and profile-style images.
For a single validation rule:
Image
│
├── Aspect Ratio matches?
│
└── Minimum Width satisfied?
│
▼
ValidFor multiple rules:
┌── Rule 1 ── Valid
│
Image ────────┼── Rule 2 ── Valid
│
└── Rule 3 ── Invalid
│
▼
Image is ValidAn image only needs to satisfy one complete rule.
For example:
Rule 1: 16:9 + 2048px
Rule 2: 4:3 + 1600px
Rule 3: 1:1 + 1200pxA 4:3 image that is 1600px wide passes Rule 2 even if it does not satisfy Rule 1 or Rule 3.
Rebuild the Strapi Admin Panel:
npm run buildThen restart Strapi.
Make sure:
Check:
0.02.If you encounter a bug or have a feature request, please open an issue in the project's GitHub repository.
When reporting a bug, include:
Contributions are welcome.
For significant changes, please open an issue first to discuss the proposed approach.
Possible future improvements include:
The roadmap may change based on project requirements and community feedback.
This project is licensed under the MIT License.
Share your work with the community and get it listed in the Strapi ecosystem for everyone to discover and use.
Submit
