[][src]Crate icon_baker

A simple solution for generating .ico and .icns icons. This crate serves as IconBaker CLI's internal library.

Basic Usage

use icon_baker::prelude::*;
 
const N_ENTRIES: usize = 1;
 
fn main() {
    // Creating the icon
    let mut icon = Icon::ico(n_entries);
 
    // Importing the source image
    let src_image = SourceImage::from_file("img.jpg").unwrap();
 
    // Configuring the entry
    let opts = IconOptions::new(
        vec![(32, 32), (64, 64)] /* 32x32 and 64x64 sizes */,
        ResamplingFilter::Linear /* Iterpolate the image */,
        Crop::Square             /* Square image */
    );
 
    // Adding the entry
    icon.add_entry(opts, &src_image).unwrap();
}

Supported Image Formats

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)

Re-exports

pub extern crate nsvg;
pub use nsvg::image;

Modules

prelude

Structs

Icon

A generic representation of an icon.

IconOptions

A representation of an entry's properties.

Enums

Crop
Error
IconType
ResamplingFilter
SourceImage

A representation of a bitmap or an svg image.

Traits

FromFile

Trait for constructing structs from a given path.

Type Definitions

Result
Size