[][src]Crate iconwriter

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

Basic 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_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

FormatDecoding
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

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.

Raster

Rasterizes a generic image to series of RgbaImage's, conforming to the configuration options specifyed in the options argument.

Type Definitions

Result
Size
SourceMap