robohash 0.2.0

RoboHash implementation
Documentation

RoboHash

Rust implementation of RoboHash by e1ven

Install

robohash = "0.2.0"

Example Implementation

use std::fmt::Error;
use robohash::RoboHashBuilder;

fn main() -> Result<(), Error> {
    let text = "test";
    let robo = RoboHashBuilder::new(text).build();
    let robo_hash = robo.assemble_base64()?;
    println!("{robo_hash:#?}");
    Ok(())
}

Define Colour

let robo = RoboHashBuilder::new("test")
    .with_colour(Colour::Green)
    .build();

Define Set

let robo = RoboHashBuilder::new("test")
    .with_set(Set::Set3)
    .build();

Change Sets Directory

let robo = RoboHashBuilder::new("test")
    .with_set_location("./sets_location")
    .build();

Full Example

use std::fmt::Error;
use robohash::RoboHashBuilder;

fn main() -> Result<(), Error> {
    let text = "test";
    let robo = RoboHashBuilder::new(text)
        .with_set(Set::Set1)
        .with_colour(Colour::Green)
        .with_set_location("./sets-root")
        .build();
    let robo_hash = robo.assemble_base64()?;
    println!("{robo_hash:#?}");
    Ok(())
}

Implemented

  • Generate base64 robo hash image from any of the provided sets and colours

Todo

  • Support backgrounds
  • Support for saving images to disk
  • Support for returning raw image data
  • Support image resizing