favy

Crates.iofavy
lib.rsfavy
version0.1.0-beta.3
sourcesrc
created_at2019-10-28 12:31:06.689148
updated_at2019-11-06 14:55:19.070371
descriptionA simple solution for generating favicon schemes.
homepagehttps://github.com/GarkGarcia/favy
repositoryhttps://github.com/GarkGarcia/favy
max_upload_size
id176365
size22,974
Gark Garcia (GarkGarcia)

documentation

README

favy

Crate API Minimum rustc version Downloads License

A simple solution for generating favicon schemes.

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 😃

Commit count: 0

cargo fmt