Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get high resolution website logo (favicon) for a given URL

I'm developing a web browser on Android and want to show the URL logo for the most visited sites like in Chrome (4 X 2). But the problem is that most favicons (eg: http://www.bbc.co.uk/favicon.ico) are of size either 16X16 or 32X32 and they don't look good when scaled up.

Is there a way I can download a high resolution icon/bitmap for an URL in a standard way? How about opening the home page and then extracting all the image links and then choose an image with the name logo in it? Would this method work for all the URLs? I want to know if there is a standard way to obtain a high resolution icon for a given URL or favicon is the only standard way to get the website logo?

like image 725
AndroidDev Avatar asked Feb 24 '14 14:02

AndroidDev


People also ask

How do I make my favicon not pixelated?

The main trick to making the smoother website icon is to first design it using Adobe Photoshop at the scale size it will be used. The recommended favicon size is 16 x 16 pixels. So you have to create your artwork in that size.

Do all websites have a favicon displayed in the URL?

Nowadays, favicons are displayed right above the address bar regardless of whether the website is bookmarked or not. And in the small chance that a website doesn't have a favicon, the browser will display a generic browser symbol. 2. In addition to the address bar, favicons can also be found in the browser history.


2 Answers

You can code it yourself or use an existing solution.

Do-it-yourself algorithm

  1. Look for Apple touch icon declarations in the code, such as <link rel="apple-touch-icon" href="/apple-touch-icon.png">. Theses pictures range from 57x57 to 152x152. See Apple specs for full reference.
  2. Even if you find no Apple touch icon declaration, try to load them anyway, based on Apple naming convention. For example, you might find something at /apple-touch-icon.png. Again, see Apple specs for reference.
  3. Look for high definition PNG favicon in the code, such as <link rel="icon" type="image/png" href="/favicon-196x196.png" sizes="196x196">. In this example, you have a 196x196 picture.
  4. Look for Windows 8 / IE10 and Windows 8.1 / IE11 tile pictures, such as <meta name="msapplication-TileImage" content="/mstile-144x144.png">. These pictures range from 70x70 to 310x310, or even more. See these Windows 8 and Windows 8.1 references.
  5. Look for /browserconfig.xml, dedicated to Windows 8.1 / IE11. This is the other place where you can find tile pictures. See Microsoft specs.
  6. Look for the og:image declaration such as <meta property="og:image" content="http://somesite.com/somepic.png"/>. This is how a web site indicates to FB/Pinterest/whatever the preferred picture to represent it. See Open Graph Protocol for reference.
  7. At this point, you found no suitable logo... damned! You can still load all pictures in the page and make a guess to pick the best one.

Note: Steps 1, 2 and 3 are basically what Chrome does to get suitable icons for bookmark and home screen links. Coast by Opera even use the MS tile pictures to get the job done. Read this list to figure out which browser uses which picture (full disclosure: I am the author of this page).

APIs and open source projects

RealFaviconGenerator: You can get any web site favicon or related icon (such as the Touch Icon) with this favicon retrieval API. Full disclosure: I'm the author of this service.

BestIcon: Although less comprehensive, Besticon offers a good alternative, especially if you want to host the code yourself. There is also a hosted version you can use right away.

like image 179
philippe_b Avatar answered Sep 21 '22 06:09

philippe_b


The Go code at https://github.com/mat/besticon tries to solve this problem.

For example

$ besticon http://github.com  http://github.com:  https://github.com/apple-touch-icon-144.png 

There is also an accompanying hosted version of the code, see for example http://icons.better-idea.org/icons?url=github.com.

(Disclaimer: I wrote it because I needed to solve the same problem a while ago.)

like image 42
mat Avatar answered Sep 20 '22 06:09

mat