# favy [![Crate](https://img.shields.io/crates/v/favy)](https://crates.io/crates/favy) [![API](https://docs.rs/favy/badge.svg)](https://docs.rs/favy) ![Minimum rustc version](https://img.shields.io/badge/rustc-1.37+-lightgray.svg) ![Downloads](https://img.shields.io/crates/d/favy) [![License](https://img.shields.io/crates/l/favy)](https://github.com/GarkGarcia/favy/blob/master/LICENSE) A simple solution for generating _favicon schemes_. # Overview **Favy** is a library for encoding _favicon schemes_, based on [`ikon`](https://github.com/GarkGarcia/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_. ```rust 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`](https://docs.rs/favy/favy/resample/index.html) module. Vector graphics are never resampled. # Support This are the _[supported image formats](https://github.com/GarkGarcia/ikon#support)_. | 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](https://github.com/RazrFalcon/resvg#svg-support) | # Build Requirements **Favy** relies on [`harfbuzz_rs`](https://crates.io/crates/harfbuzz_rs), wich means [CMake](https://cmake.org/) is required to be installed for it build. # License Licensed under MIT license([LICENSE-MIT](https://github.com/GarkGarcia/favy/blob/master/LICENSE) 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 😃