Cropping an image without upscaling?

Good catch @texnixe, I edited my post :wink:

@lukasbestle, I agree. This is in no way to be taken as a solution, but only as a workaround for @alexanderhahn. As you said, if there was a solution to the no upscale that would work in every scenario, I trust that you’d have implemented it :wink:

But with that condition you do the exact opposite, you only upscale. :smiley:

1 Like

Right… Facepalm !!
Thanks for pointing that out, I edited my posts to avoid confusion

That might be a temporary fix but please note that (as I wrote above) not cropping the image at all will lead to layout issues as the images won’t have the expected aspect ratio.

In most cases yes, but not always. I ran into this issue today. I need to crop the image so that it never exceeds a maximum height or width. If it’s too wide it should crop. If it’s too high, it should crop.

So, about the aspect ratio. It will be something else, but when using it as a background for example it’s not as important. We could use the css feature background-size: cover and it will just use the space it needs.

In conclusion, I think there should be an option to crop, without upscale.

A workaround can be to use this: GitHub - gumlet/php-image-resize: PHP library to resize, scale and crop images. Cloud solution available at:

It’s been a while. Is there a solution to that already?

I would like to do the following in the new Uploader in v4:

An image has the dimensions 100x200.

The file template options lool like the following:

create:
  width: 500
  height: 500
  crop: true

The current result: The image is cropped and upscaled to 500x500.

What I would like: The image should only be cropped to have the right aspect ratio. So the resould would be an image of 100x100.

There are many possible options for cropping. See for example the Cloudinary Docs about Resize and Crop Modes. The one I’d need would probably bee lfill.

Hm, at first sight there doesn’t seem to be an option to prevent upscaling, even though when you do a resize via Kirby’s thumb methods, files are not upscaled. Might be a bug.

1 Like