I’m submitting a…
[ ] Regression (a behavior that stopped working in a new release)
[x] Bug report
[ ] Performance issue
[ ] Documentation issue or request
Current behavior
When using “Crop” resize mode for images assets and the actual image is smaller than requested size then resize behavior is reset to “BoxPad”.
For example, I have 600x400 images and want to crop/resize it to:
- 320x320
- 640x640
In first case the image will be correctly resized and cropped, but in second case the image is not resized at all but it is pad with black color instead.
Expected behavior
Even if the image is smaller than target size I expect it to be scaled up and cropped, instead of padding it with black.
E.g. “600x400” image (if targeting “640x640”) should be scaled up to “960x640” and then cropped to “640x640”.
Alternatively we can avoid scaling images up by adjusting target size, e.g. for “600x400” image (if targeting “640x640”) we should adjust target size to “400x400” instead and return 400x400 images cropped out from original image.
Note, that in our case images are uploaded by customers, so we can’t control their sizes and we don’t want to restrict minimum images sizes. It will be good if Crop mode is implemented correctly.
Minimal reproduction of the problem
You can experiment with this image: https://www.w3schools.com/w3css/img_lights.jpg, and use “640x640” as target size, e.g. “[asset_url]?width=640&height=640&mode=Crop”.
Environment
- [ ] Self hosted with docker
- [x] Self hosted with IIS
- [ ] Self hosted with other version
- [ ] Cloud version
Browser:
- [ ] Chrome (desktop)
- [ ] Chrome (Android)
- [ ] Chrome (iOS)
- [ ] Firefox
- [ ] Safari (desktop)
- [ ] Safari (iOS)
- [ ] IE
- [ ] Edge
Others:
BTW, I think there is a typo in Assets docs (https://docs.squidex.io/guides/05-assets), the last mode should be “Stretch”, not “Crop” (already defined above).