favy 0.1.0-beta.1

A simple solution for generating favicons.
Documentation

favy

Crate API Minimum rustc version Downloads License

A simple solution for generating favicons.

Overview

Favy is a library for encoding favicon schemes, based on ikon. It provides functionalities for quickly rasampling multiple pictures and cobining them into favicons.

Favicons are represented as maps between positive integers and images. An entry is a key-value pair contained in an favicon.

use favy::{resample, encode::{Encode, Save}, Image, Favicon, Size};

fn main() -> io::Result<()> {
    // Initialize the icon
    let mut icon = Favicon::new();

    // Add a single entry
    let image = Image::open("example.png")?;
    icon.add_entry(resample::linear, &image, Size(32))?;

    // Add multiple entries
    icon.add_entries(
        resample::linear,
        &image,
        vec![Size(64), Size(128), Size(256)]
    )?;

    // Save the icon to disk
    icon.save("~/favicon/")
}

Resampling

Raster graphics are scaled using resampling filters, which are represented by functions that take a source image and a size and return a re-scaled image.

This allows the users of this crate to provide their custom resampling filters. Common resampling filters are provided in the resample module.

Vector graphics are never resampled.

Support

This are the supported image formats.

Format Supported?
png All supported color types
jpeg Baseline and progressive
gif Yes
bmp Yes
webp Lossy(Luma channel only)
svg Static SVG Full 1.1

Build Requirements

Favy relies on harfbuzz_rs, wich means CMake is required to be installed for it build.

License

Licensed under MIT license(LICENSE-MIT or http://opensource.org/licenses/MIT).

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be licensed as above, without any additional terms or conditions.

Feel free to help out! Contributions are welcomed 😃