svelte-image icon indicating copy to clipboard operation
svelte-image copied to clipboard

Feature Request: cropping images

Open MatthiasGrandl opened this issue 6 years ago • 4 comments

Often times, you want different aspect ratios for different size displays. So it would be cool, to be able to this with svelte-image.

Even cooler if you could specify the vocal point. With a CMS like CraftCMS you can specify the vocal point while uploading and this could be used to perfectly crop them with svelte-image.

I might try to do a PR, if I get around to it.

MatthiasGrandl avatar Sep 27 '19 10:09 MatthiasGrandl

yes, i second this, as this is a really critical aspect of image processing and art direction in general, and one of the last things that is a pain and often must done done manually. Being able to specify different aspect ratios / pixel dimensions and then specify a focal point to crop to would be a great time saver, indeed. Even with gatsby-image making optimizations and many sizes I still have to manually crop every image and optimize it before throwing it into gatsby-image. Being able to do this in svelte-image would make svelte even more compelling.

rchrdnsh avatar Oct 28 '19 23:10 rchrdnsh

Out of curiosity, how would you both want such a feature to work?

happycollision avatar Nov 06 '19 06:11 happycollision

I get the focal point, but all cropping should probably be covered by object-fit, no?

matyunya avatar Nov 06 '19 06:11 matyunya

Art direction is what I'm after. object-fit does not allow one to set a focal point on the image, so when the image tries to fit itself to the container, it defaults to staying the middle of the image, to the best of my knowledge. Cropping is not about different sizes, it is about different sizes, aspect ratios, and most important of all, different focal points for each crop, rather than defaulting to the center of the image, which does not work in all cases. I'm not sure how this could work, and maybe it needs a GUI, as CMS's that offer this allow one to visually select focal points for crops. I hope that makes sense.

For a specific example, I recently had an image of the Las Vegas sign, and at a 4x1 ratio the sign needs to be on the far right. But the 1x1 aspect ratio would need the sign to be dead center. I have to do this kind of work manually now, but it would be great to specify an aspect ratio, then a focal point for that aspect ratio, and have the build process do the work. object-fit would mean that the sign it not visible at all, most likely.

rchrdnsh avatar Nov 08 '19 00:11 rchrdnsh