Hacker News new | past | comments | ask | show | jobs | submit login

I think "scale-down" is the closest to what you're after. If you have a 400x600 original, and request 512x512, you'll be served a 341x512 image. This maintains the original image's aspect ratio, and a fits within the requested (512x512) size.

Original: https://via.placeholder.com/400x600 Resized: https://gregbrimble.com/cdn-cgi/image/fit=scale-down,w=512,h...




I want to maintain the aspect ratio of my crop, not that of the source image. Perhaps `fit=cover-scale-down` would be a more appropriate name. In other words, I always want a square image <= 512px wide. I think this is a very common use case.


If there's no way to specify where the center (or w/e) of your crop is on the source image, it's not going to happen.


Even I can do ‘most interesting part’ detection. CF certainly can.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: