0.0
No commit activity in last 3 years
No release in over 3 years
Fetch favicons from webpages and have a blast!
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 5.0
~> 0.10
~> 10.0

Runtime

~> 1.6
 Project Readme

Favicon Party

Fetch favicons from webpages and convert them into various image formats!

Installation

You can install FaviconParty through RubyGems

$ gem install favicon_party

Or add it to your application's Gemfile and install via bundler

gem 'favicon_party'

Fetching favicon images

FaviconParty parses the html response of the query url to find favicon links and falls back to checking /favicon.ico

image = FaviconParty.fetch! "github.com"
#  => #<FaviconParty::Image mime_type: "image/x-icon", size: 6518>

If a valid favicon isn't found:

FaviconParty.fetch! "http://example.com"    # raises FaviconNotFound
FaviconParty.fetch  "http://example.com"    # nil

Converting favicon images

To access the source favicon data and convert it into various image formats:

image.source_data   # binary favicon image data
image.to_png        # binary 16x16 png data
image.base64_png    # base64-encoded 16x16 png data

Loading favicon images

You can load favicon data from image files:

image = FaviconParty.load "/path/to/favicon.ico"
#  => #<FaviconParty::Image mime_type: "image/x-icon", size: 6518>

image.valid?  # true

And also load them directly from their source URLs:

image = FaviconParty.load "https://github.com/favicon.ico"
#  => #<FaviconParty::Image mime_type: "image/x-icon", size: 6518>

Command-line client

FaviconParty also provides a command-line script for fetching favicons. By default, it attempts to fetch a favicon from the given URL and prints it to stdout. Run fetch_favicon --help to see the list of options.

fetch_favicon github.com                  # prints favicon data to STDOUT
fetch_favicon --format png github.com     # prints 16x16 favicon png to STDOUT
fetch_favicon example.com                 # prints an error to STDERR

Requirements