jhchen/ansize

How about keeping the original proportion by default?

Closed this issue · 1 comments

Hi @jhchen

Thanks for the tool, it's fully accorded with my need, I appreciated that.

I found the output got seriously squeezed with images of relatively large height to width ratio.

Here's what makes it so:

PROPORTION float32 = 0.46

m := resize.Resize(uint(width), uint(float32(width) * PROPORTION), img, resize.Lanczos3)

The image height during the resizing is hardcoded to width * 0.46, but why 0.46?

How about keeping the original proportion by passing 0 as height to Resize?

I believe it had to do with the character width and height ratio of the font and I tweaked with the images I wanted to use to see what was the best result. Feel free to tweak yourself if you use a different one.