itgalaxy / favicons

Favicons generator for Node.js
MIT License
1.19k stars 164 forks source link

Keep ratio when scaling? #334

Closed Tofandel closed 2 years ago

Tofandel commented 3 years ago

Is there any option or way to have the image fitted keeping the proportions when generating the favicon other than to resize the image directly?

Currently if the image is not square it gives bad results

andy128k commented 2 years ago

I was not able to reproduce the issue. See #360 It may happen that the issue was already fixed in master branch.

@Tofandel May you check it again?

ghost commented 2 years ago

Hello,

I have encountered the same issue when using a non-square svg file without a viewBox attribute on the tag. Adding the attribute on the same exact file solved the issue.

andy128k commented 2 years ago

@jbroutier which version do you use? May you provide a reproducible test?

ghost commented 2 years ago

I'm using version 6.2.2.

Sure, here it is: https://github.com/jbroutier/favicons-334 Run both src/with-viewbox.js & src/without-viewbox.js and compare the generated files in the corresponding output folder.

In the second case some of the generated favicons are not centered and have an abnormally huge padding on some sides. It looks like it's broken only when the target favicon size is bigger than the source file size.

andy128k commented 2 years ago

@jbroutier Thanks!