1use si_img::{SiFont, SiImage, TextOptions};
2
3use std::{fs, io::Write};
4
5fn main() {
6 let mut img = SiImage::from_network("https://res.cloudinary.com/zype/image/upload/regraphic");
8 let font = SiFont::from_network(
10 "https://github.com/Zype-Z/ShareImage.js/raw/main/assets/fonts/sirin-stencil.ttf",
11 );
12 let text_options = TextOptions::default();
14 img = img
19 .clone()
20 .render_text(
21 "Hello, World!",
22 64.0,
23 480.0,
24 254.0,
25 None,
26 &font,
27 &text_options,
28 )
29 .render_text(
30 "Hello, Another!",
31 48.0,
32 480.0,
33 320.0,
34 None,
35 &font,
36 &text_options,
37 );
38 let mut file = fs::OpenOptions::new()
40 .create(true) .write(true) .open("out.png")
43 .unwrap();
44 file.write_all(&img.to_bytes()).unwrap();
45}