GruntJS plugin for RealFavionGenerator is now available

The promise of RealFaviconGenerator is to let you create a multiplatform favicon within minutes, the same amount of time we needed 10 years ago when a single favicon.ico file was enough. This mission is good enough for many web projects where the favicon creation can be a one-time operation.

However, web development practices evolve and even the most static web projects now make use of build tools to automate certain tasks. CSS and JavaScript files got merged and minified. HTML pages are moved. Different versions of the same site are created. GruntJS and Gulp are the tools of choice to perform these tasks.

RealFaviconGenerator is now available in GruntJS as a plugin: grunt-real-favicon. This plugin lets you integrate RealFaviconGenerator to your web project workflow. For example:

grunt.initConfig({
  real_favicon: {
    my_icon: {
      src: 'pics/high_res_logo.png',
      dest: 'dist/path/to/icons',
      icons_path: '/path/to/icons',
      html: ['dist/index.html', 'dist/about.html'],
      design: {
        ios: {
          picture_aspect: 'background_and_margin',
          background_color: '#654321',
          margin: 4
        },
        windows: {
          picture_aspect: 'white_silhouette',
          background_color: '#123456'
        }
      },
      settings: {
        compression: 5,
        scaling_algorithm: 'NearestNeighbor'
      }
    }
  }
});

If you know GruntJS and RealFaviconGenerator, the code above should be familiar.

The plugin is just new. Expect it to evolve. I hope to receive user feedback and make it the reference for favicon generation with GruntJS!

Say hello to the iPhone 6 Plus and its 180×180 icon!

The iPhone 6 was released a few hours ago. Guess what? The iPhone 6 Plus and its large screen comes with a new Apple Touch icon: a 180×180 picture.

RealFaviconGenerator was just updated to provide you the latest set of icons to support all iOS devices. Sure, unless the iPhone 6 Plus becomes an instant hit, there is no hurry to update…

Update for Android – RFG’s package v0.8

Version 0.8 of the RFG’s package was released yesterday. It contains two fixes in one:

If you use the WordPress plugin, you may have already been notified of the update.

What’s next? Regarding Android, the next step is to let you design an icon dedicated to Chrome. Android look and feel is different of desktop platforms and iOS, so I think this feature make sense.

Android Chrome and its favicon

Favicon is more or less complex from a platform to another. I think Chrome for Android is the trickiest.

With iOS, things are not that easy but clear: Apple defined the Apple Touch icon, a proprietary mechanism. This approach makes sense. After all, when iOS was introduced, it required new, high resolution icons that did not exist anywhere else. As a result, we have a somehow proprietary markup with a specific apple-touch-icon relation attribute. The Apple Touch icon comes with an advantage: because it is specified for iOS, Apple can enforce design guidelines. Solid background, rounded corners, etc.

Unlike iOS Safari, Android Chrome (Chrome for short) does not define any proprietary mechanism. That surely sounds good. No one likes vendor-specific stuff. But this approach comes with a cost. More of this below.

As indicated in the specs, Chrome relies on two sets of icons:

  • Apple Touch icon. Yep, the primary choice for Chrome is (… was) the icon defined for its competitor. This is a sensible behavior: with so few support for high resolution icon, supporting the famous Apple Touch icon gives Chrome the best chance to find a suitable icon.
  • Two 192×192 and 128×128 PNG icons, with a preference for the 192×192 icon. These icons are based on standard HTML5 markups.

It is easy to figure out Google’s strategy: introduce a dedicated 192×192 high resolution icon and fallback to the Apple Touch icon when not available. Pragmatic, as it should be. But the devil is in the details, and when you try to create the ideal favicon, things become quite tough.

192×192 or 196×196

A small detail as a starter. I started to study Chrome’s icon for almost a year. In the beginning, it was a 196×196 icon. When I started this article, I re-read the specs, something I had not done for a while. I realize there was a change: 196×196 became 192×192.

As we will see below, this is a major change because today’s Chrome (version 37) does not use the 196×196 PNG icons that were designed especially for it.

Apple Touch icon or PNG icon

Since Chrome supports two kind of icons, which one does it use? Looking at the compatibility page of RealFaviconGenerator:

Android Chrome version Favicon Bookmark icon Home screen icon
31 16×16 PNG icon 152×152 Apple Touch icon 152×152 Apple Touch icon
32 196×196 PNG icon 152×152 Apple Touch icon 196×196 PNG icon
35 32×32 PNG icon 152×152 Apple Touch icon 152×152 Apple Touch icon
36 160×160 PNG icon 160×160 PNG icon 160×160 PNG icon
37 (latest version at time of writing) 160×160 PNG icon 160×160 PNG icon 160×160 PNG icon

Apparently, Google finally set its preference to the PNG icon, if it can find one.

This brings consistency: let’s design a PNG icon and Chrome will not pick anything from Apple. But now comes the trick. Sure we can design an icon for Chrome. But as the PNG icons are declared with standard HTML5, other browsers can use it, too. This is what happens with the current pictures and code generated with RealFaviconGenerator (version 0.7). Because the Chrome PNG icon is quite large, some browsers, such as IE11, consider it as a good choice. This is no good news when the author of RealFaviconGenerator decides that the Chrome icon must be designed after the iOS icon.

Which PNG icon?

According to the specs, Chrome picks the 192×192 icon if it finds it, the 128×128 icon otherwise. Is that the case? To demonstrate this, I generated all PNG icons from 16×16 to 256×256 and declared them:


<link rel="icon" type="image/png" href="/16.png" sizes=16x16>
<link rel="icon" type="image/png" href="/17.png" sizes=17x17>
<link rel="icon" type="image/png" href="/18.png" sizes=18x18>
...
<link rel="icon" type="image/png" href="/255.png" sizes=255x255>
<link rel="icon" type="image/png" href="/256.png" sizes=256x256>

With this code, Android Chrome uses the 192×192 icon, as expected. Good.

What if it is not present? Chrome selects the icon just below: 191×191. This make sense, although the specs say nothing about this. And it goes on and on. Delete everything from 129×129 to 192×192 and Chrome uses the “low resolution” 128×128 icon. Delete it and Chromes takes the 127×127 icon. In the end, if you offer Chrome a 16×16 icon and icons larger than 192×192 (eg. 193×193, 194×194, etc.), it uses the 16×16 icon.

Thus, this general rule about Android Chrome 37: Chrome uses the same icon as the favicon, bookmark icon and “Add to home screen” icon. It picks the widest PNG icon it can find which is no larger than 192×192.

The goal of this post is to prepare a fix for issue #26. In the next version of RealFaviconGenerator, Chrome’s icon and classic PNG icons will be correctly dispatched.