Replies: 3 comments 10 replies
-
Hey @gurgeous , thank you for the extensive research and the good ideas! My thoughts:
If you want to tackle any of it, I'd say: give it a go, would be more than happy to accept contributions on these 👍 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Excellent, glad to hear it! I'll try to explore these one at a time, maybe starting with (2). Stay tuned... |
Beta Was this translation helpful? Give feedback.
8 replies
-
So @mat, what should we work on next? Chrome compat? Cleanup? Richer test suite / top 1000? I can do more, I think :) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey Mat. I love besticon, thank you for creating such a great project and maintaining it for so long! I was thinking of making some enhancements and I wanted to get your thoughts. I'm an experienced engineer, though relatively new to Go so please be gentle 😄
I've gone deep on favicons this week. Real deep. Too deep, maybe. I dug into Chromium's favicon code and examined the sqlite db under the hood. I studied the favicon links for the Tranco top 1000 websites. Here are some ideas to consider:
Add support for more formats. See below for the formats from the top 1000.
Make the parser a bit more flexible. See below for the rel attributes from the top 1000.
Add support for the Chromium favicon finder, or an approximation (see below). This could be done as an ENV variable or a query param. The nice thing about this approach is that it would result in icons that are almost always in agreement with Chrome. We could even make it the default if you ask for a small icon. Maybe it should be a bug (or known issue) if besticon and Chrome disagree. Probably the biggest difference today is that besticon searches the apple touch icons by default.
Richer test suite. Maybe we can include some of the top 1000 in the suite? I like your VCR infrastructure. I also have an unreleased httpdisk package that I'm working on, if we wanted to move this out of besticon. Suggestions welcome, of course.
Image normalization. Wouldn't it be nice if besticon could always return a normalized png of the requested size? At the very least we could add a script to make this easier. My team uses some Ruby code to drive imagemagick, librsvg, zopfli, etc.
What do you think? Sorry for the wall of text 😄
Appendix: Chromium Favicon Finder
Chromium uses the following algorithm for finding a favicon:
/favicon.ico
.sizes
attribute to determine if the icon is close to 16x16 or 32x32. See select_favicon_frames.cc. Icons without asizes
attribute are optimistically scored1.0
.score
. Ties are broken bottom to top, per the [rel icon spec].Chromium also has some bugs - it doesn't support
sizes="any"
properly, for example, and ironically treats it like a0x0
icon.Appendix: From the Top 1000
Beta Was this translation helpful? Give feedback.
All reactions