Crates.io | favy |
lib.rs | favy |
version | 0.1.0-beta.3 |
source | src |
created_at | 2019-10-28 12:31:06.689148 |
updated_at | 2019-11-06 14:55:19.070371 |
description | A simple solution for generating favicon schemes. |
homepage | https://github.com/GarkGarcia/favy |
repository | https://github.com/GarkGarcia/favy |
max_upload_size | |
id | 176365 |
size | 22,974 |
A simple solution for generating favicon schemes.
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/")
}
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.
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 |
Favy relies on harfbuzz_rs
, wich means
CMake is required to be installed for it build.
Licensed under MIT license(LICENSE-MIT or http://opensource.org/licenses/MIT).
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 😃