A simple solution for generating .ico
and .icns
icons. This crate serves as IconWriter CLI's internal library.
use iconwriter::prelude::*;
const N_ENTRIES: usize = 1;
fn main() {
let mut icon = Icon::ico(n_entries);
let src_image = SourceImage::from_file("img.jpg").unwrap();
let opts = IconOptions::new(
vec![(32, 32), (64, 64)] ,
ResamplingFilter::Linear ,
Crop::Square
);
icon.add_entry(opts, &src_image).unwrap();
}
Format | Decoding |
PNG | All supported color types |
JPEG | Baseline and progressive |
GIF | Yes |
BMP | Yes |
ICO | Yes |
TIFF | Baseline(no fax support), LZW , PackBits |
WEBP | Lossy(Luma channel only) |
PNM | PBM , PGM , PPM , standard PAM |
SVG | Limited(flat filled shapes only) |
pub extern crate nsvg; |
pub use nsvg::image; |
Icon | A generic representation of an icon.
|
IconOptions | A representation of an entry's properties.
|
FromFile | Trait for constructing structs from a given path.
|
Raster | Rasterizes a generic image to series of RgbaImage 's, conforming to the configuration options specifyed in the options argument.
|