encrypted-images/examples/create_an_image_custom_watermark.rs

19 lines
152 KiB
Rust
Raw Permalink Normal View History

2024-07-16 23:40:41 +00:00
use encrypted_images::encryption::images::create_img;
fn main() {
let ciphertext = "VkdocGN5QkpjeUJRYkE9PZNY2MOW01NWpSxCtFG6acHuAWun+CElPQ/IIwd0gy+D+IiBqB/5+qo8Jr9bMBOwoih3amCtjXlkAlRKHX5fhqI=";
let style = "h";
let watermark = "iVBORw0KGgoAAAANSUhEUgAACqMAAAqjCAYAAACgs6lKAAAACXBIWXMAAAsTAAALEwEAmpwYAAAgAElEQVR42uzau69cVxnG4WMcKaQgJA0EEBIQQxRm5jgkokgBBKhTnpJI3EwVoVDgKJ49mtJtSrcpLVGlNB2GiJJbKMOlgihKFPvMHluyh3PkAEl8O5dv1uy1vueRfv/ALtanLb1bq9VqS5I0zAA4vHG3/NW461eStIlGXf/WpFue2dlZnfQiAwAAAADEsSGQpIHvnHwESTJGBWiJMaqkgfSXyWyxs/fXfcLLDAAAAABwfDYEkmSMKkkyRgUoxhhV0qCaLv5wa5QKAAAAAMBx2BBIkjGqJMkYFaAYY1RJA+13o2n/Pa80AAAAAMDR2BBIkjGqJMkYFaAYY1RJA+/ydtd/y2sNAAAAAHA4NgSSZIwqSTJGBSjGGFVSJV3anu8+7dUGAAAAADgYGwJJMkaVJBmjAhRjjCqpom7uvVkXt6fLJ7zeAAAAAAD3ZkMgScaokiRjVIBijFElVdiN/VHqeLp83CsOAAAAAHBnNgSSZIwqSTJGBSjGGFVSxV0fdf2F0+cWX/CaAwAAAAB8lA2BJBmjSpKMUQGKMUaV1EDX9kepo/nVx7zqAAAAAAC32BBIkjGqJMkYFaAYY1RJDXV1NFuen7z83qNedwAAAAAgOxsCSTJGlSQZowIUY4wqqcHe3x+lnpqvHvbKAwAAAABZ2RBIkjGqJMkYFaAYY1RJDff2ZLo4++xLq4e89gAAAABANjYEkmSMKkkyRgUoxhhVUoL+tT9KPfXi6kGvPgAAAACQhQ2BJBmjSpKMUQGK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k
let r = Some(100);
let g = Some(134);
let b = Some(137);
let a = Some(0);
let w = Some(32);
let h = Some(32);
if let Some(encoded_image) = create_img(ciphertext, style, watermark, r, g, b, a, w, h) {
println!("Encoded image: {}", encoded_image);
} else {
println!("Image creation or encoding failed.");
}
}