h2non / imaginary

Fast, simple, scalable, Docker-ready HTTP microservice for high-level image processing
https://fly.io/docs/app-guides/run-a-global-image-service/
MIT License
5.55k stars 456 forks source link

How to generate a fixed size thumbnail without cropping or distorting? #392

Open bluepuma77 opened 2 years ago

bluepuma77 commented 2 years ago

I would like to create fixed size thumbnails of images. The /thumbnail endpoint seems to resize which distorts the image. The /fit endpoint will "fit" the image within the specified target size, but the image may be smaller. The image operations are not really explained in detail.

I would like to call /operation?width=200&height=200&url=https://via.placeholder.com/400x200.png?text=400x200 to get a 200x200 image with "fitted" original content that has the empty space filled with transparency (or a defined background color). Is that possible?

Imaginary-Thumbnails
bluepuma77 commented 2 years ago

Related #358

bergo commented 1 year ago

Had the same problem, used:/enlarge?width=430&height=430&extend=white&embed=true&nocrop=true&url=http://... That works for me.