When using responsive images, is it possible to crop to as aspect ratio?

Hi, New user here!

I am implementing responsive images using the 'Sizes with media queries using derivatives’ method.

[edit: I am implementing this in the template / twig]

Is there a way to crop the image(s) to a specific aspect ratio?
I use this for a thumbnail gallery and would prefer to not serve extra pixels, when they will be hidden through css.

Thank you!

@jrzav, What happens if you do the following in Twig?

image.crop(100,100,300,200).derivatives([100, 200, 300]).html()

The crop is not performed.

I guess this and this (@anon76427325, check the latter :wink:) are related and still not fixed/developed. As mentioned, probably won’t happen until Grav 2.0

@Karmalakas, I totally forgot about the issue I contributed to… :man_facepalming:

Thank you @Karmalakas and @anon76427325, that answers this question :wink:

I only remembered it because it was my issue :sweat_smile:

What about the image content? If you always crop a 4:3 ratio to 3:2 and cut the same amount on each side, an 4:3 image with a persons head near the cropped side would be cut - what results a non pleasing image content. So, just cropping might be an overall goal missing jump.

But if you have 6000x4000 px (3:2) image and you want to keep original, I doubt you’d want to output a list of lets say 20 images 24MB each. That’s where cropZoom(1800, 1200) comes in