1 unstable release

0.1.0 Oct 2, 2024

#412 in Images

BSD-3-Clause

10KB
189 lines

sigil

small and fast identicon generator.

sigil is compatible with, and ports some code from, Cupcake Sigil.

Before 1.0, I want to:

  • Produce smaller PNGs
  • Maybe optionally produce SVGs
  • Maybe provide access to the intermediate derived data

License

BSD-3-Clause


lib.rs:

A small and fast identicon generator.

sigil is compatible with Cupcake Sigil.

Example

use sigil_rs::Theme;
use sigil_rs::Sigil;

// The default theme uses 5 rows/columns.
let theme = Theme::default();
let sigil = Sigil::generate(&theme, "username");

// The width value must be a multiple of `(rows + 1) * 2`.
let image = sigil.to_image(240);
image
    .save("username.png")
    .expect("writing to disk failed");

Image formats

The Sigil::to_image function method returns an RgbImage. sigil enables only the PNG encoder in the image crate. If you want to use a different format, enable the relevant image feature in your Cargo.toml:

[dependencies]
image = { version = "0.25", default-features = false, features = ["bmp"] }

Dependencies

~3MB
~58K SLoC