[][src]Crate iconwriter

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

Usage

use iconwriter::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_path("img.jpg").unwrap();
 
    // Configuring the entry
    let entry = Entry::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(entry, &src_image).unwrap();
}

Supported Image Formats

FormatSupported?
PNGAll supported color types
JPEGBaseline and progressive
GIFYes
BMPYes
ICOYes
TIFFBaseline(no fax support), LZW, PackBits
WEBPLossy(Luma channel only)
PNM PBM, PGM, PPM, standard PAM
SVGLimited(flat filled shapes only)

Re-exports

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

Modules

prelude

Structs

Entry

A representation of an entry's properties.

Icon

A generic representation of an icon.

Enums

Crop
Error
IconType
ResamplingFilter
SourceImage

A representation of a bitmap or an svg image.

Traits

FromPath

Trait for constructing structs from a given path.

Type Definitions

Result
Size