Tired of creating a gazillion different favicons to satisfy all kinds of devices and resolutions in different file formats?
I know I was, so I created FaviconMaker to ease the tedious process of creating multiple versions of your favicon. The basic idea is to have a template image file as source for all the different sizes and or formats (png/ico). From v1.x on it is possible to use multiple template files.
Using the DSL
setuptakes the directory config
fromdefines the template to be used
iconneeds at least a filename. Usually the size and the file format are encoded in that name e.g.
apple-touch-icon-152x152-precomposed.png, if that is the case FaviconMaker tries to extract that information. It takes an options hash as the second argument where
sizee.g. "16x16" and
formate.g. :ico can be specified. Only .ico and .png are supported. The options passed take precedence over information extracted from the filename.
each_iconis called for every generated file with the fully qualified output filepath
FaviconMaker.generate do setup do template_dir "/home/app/favicon-templates" output_dir "/home/app/public" end from "favicon_base_hires.png" do icon "apple-touch-icon-152x152-precomposed.png" icon "apple-touch-icon-144x144-precomposed.png" icon "apple-touch-icon-120x120-precomposed.png" icon "apple-touch-icon-114x114-precomposed.png" icon "favicon-196x196.png" icon "favicon-160x160.png" icon "favicon-96x96.png" icon "mstile-144x144", format: "png" end from "favicon_base.png" do icon "apple-touch-icon-76x76-precomposed.png" icon "apple-touch-icon-72x72-precomposed.png" icon "apple-touch-icon-60x60-precomposed.png" icon "apple-touch-icon-57x57-precomposed.png" icon "apple-touch-icon-precomposed.png", size: "57x57" icon "apple-touch-icon.png", size: "57x57" icon "favicon-32x32.png" icon "favicon-16x16.png" icon "favicon.png", size: "16x16" icon "favicon.ico", size: "64x64,32x32,24x24,16x16" end each_icon do |filepath| puts filepath # verbose example end end
Changes from v0.3 to v1.0
- Almost entire rewrite
- DSL to configure the output
- No internal configuration and format definitions anymore
- Support for multiple template files
Template Image Guideline
Choose the version with the biggest dimension as your base image. Currently the size 152x152 for newer iOS devices marks the upper limit. So just create a PNG with 24 or 32 Bit color depth and 152x152 document size or a vector image SVG (since v1.2). Downscaling of images always works better than upscaling. Use more than one template file to improve lower resolutions.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request
FaviconMaker v0.x - DEPRECATED
© 2011-2014 Andreas Follmann. See LICENSE for details.