sharp icon indicating copy to clipboard operation
sharp copied to clipboard

Crop image using aspect ratio instead of dimensions

Open itssamuelrowe opened this issue 4 years ago • 0 comments

It would be great if there was a builtin function that allowed us to crop images based on aspect ratio instead of dimensions. The input to such a function could be the aspect ratio and (probably) a gravity. Basically, the function would calculate the largest possible dimensions based on the aspect ratio, the gravity would influence the starting point.

There was a similar feature request. However, it was solved for 1:1, but I need to crop a 9:16 image to 16:9.

Here's a sample of how the function would look like:

aspect(16 / 9, "centre")

I could create a PR implementing this function. Someone would have to guide me though. :sweat_smile:

itssamuelrowe avatar Sep 28 '20 13:09 itssamuelrowe