AaronMorf
AaronMorf

Reputation: 13

Imageresizer : wrong cropping behavior

I would like to render all images with the same size even those which are to small.

If I render bigger images like this: ?width=768&height=365&mode=crop it would be fine but not for the small images.

When I add the scale=canvas property the bigger Images are zoomed in. Can I somehow prevent this behavior?

See examples bellow:

?width=768&height=365&mode=crop image

?width=768&height=365&mode=crop&scale=canvas
image

?width=768&height=365&mode=crop&scale=canvas
image

?width=768&height=365&mode=crop
image

Upvotes: 1

Views: 171

Answers (1)

Lilith River
Lilith River

Reputation: 16468

mode=crop and mode=pad&scale=canvas offer two mutually exclusive ways to resolve an aspect ratio difference between the image itself and what you're asking for.

  • mode=crop -> Removes data
  • mode=pad -> Adds space to resolve aspect ratio difference.
  • scale=canvas -> Adds blank space if the image is smaller than requested

We should have tested how mode=crop and scale=canvas interact, but we didn't. The behavior here is completely undefined.

Upvotes: 1

Related Questions