ComputerGhost / FaviconFetcher

Scan a webpage for favicons, or just easily download the one you want.
MIT License
5 stars 3 forks source link

Add support for SVG favicons #29

Closed kiddailey closed 3 weeks ago

kiddailey commented 5 months ago

This pull request addresses issue #15 adding support for SVG icon types that are found by a scan. This is a pretty big change and hopefully is a good solution. I'm open to suggestions, changes or improvements of course!

A few key things to note:

There are many sites that include SVG icons, but here are a few to test with:

NOTE: I have a consolidated branch containing the SVG, Async and HttpClient pull requests into one if preferred. Since each PR is based off of the mainline, it does take a little work to combine them. Let me know

kiddailey commented 5 months ago

Noticed that some SVG favicons were being "clipped" and it appears it is due to ViewBoxes that don't match the canvas size. I've added a change to ignore the ViewBox and strictly use the canvas size.

Some vector editing tools may be setting the ViewBox when saving the SVG to remember the last view in the editor. I also don't see the same clipping in browsers when accessing the SVGs directly, or in the favicon, so ignoring it seems to be proper.