generate_png_scaled_default

Function generate_png_scaled_default 

Source
pub fn generate_png_scaled_default(into_id: &[u8]) -> Vec<u8> 
Expand description

Data for small-sized identicon png, from &[u8] input slice, with default settings used for Signer app

Generates larger image and then scales it down to fit the required size, with default filter (FilterType::Lanczos3) and default scaling factor (5). Function is unfallible. If png generation itself fails, is falls back to transparent 30x30 png.

§Example

use plot_icon::generate_png_scaled_default;

let alice: &[u8] = &[212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125];
let filename = "test_pics/default_signer_alice.png";
let content = generate_png_scaled_default(alice);
assert!(std::fs::read(&filename).unwrap() == content, "Generated different image for {}!", filename);