[−][src]Crate favy
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.
Re-exports
pub extern crate ikon; |
pub use ikon::image; |
pub use ikon::resvg; |
pub use ikon::resvg::usvg; |
pub use ikon::resvg::raqote; |
Modules
resample | A collection of commonly used resampling filters. |
Structs
Favicon | A comprehensive favicon encoder. |
Size | A representation of the dimensions of a square picture.
Note that |
Enums
EncodingError | The error type for operations of the |
Image | A uniun type for raster and vector graphics. |
Traits
Encode | The |
Save | The |