kohler / gifsicle

Create, manipulate, and optimize GIF images and animations
http://www.lcdf.org/gifsicle/
GNU General Public License v2.0
3.77k stars 239 forks source link

Resize while preserving aspect ratio to specified dimensions, using fill if necessary #138

Open slayful opened 5 years ago

slayful commented 5 years ago

I've tried gifsicle on a sample of images and it is working amazing. It's fast, transforms images that other libs can't handle and the results are compatible with webP conversion.

There's however one feature I'm missing, which is resizing to specified dimensions (both width and height) while preserving aspect ratio. As far as I can tell, existing modes produce images that either preserve aspect ratio and don't exceed the dimensions, satisfying at least one (width or height) of them OR break aspect ratio and fit the dimensions exactly.

Basically what I'm looking for is gifsicle to fill the missing pixels to match the dimensions. Here's an example with a blue fill: https://ibb.co/z5GRnYb

Is this something that could be easily added?

marcing commented 5 years ago

I'm looking forward to the same feature. It's called resize with padding I believe.

Thank you.

slayful commented 5 years ago

https://github.com/kohler/gifsicle/pull/144 this should resolve this :)