2.Output an Image

This commit is contained in:
dengqn
2025-07-31 15:31:52 +08:00
commit ae2f086637
6 changed files with 72 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
use std::{fs::File, io::{BufWriter, Write}};
pub fn write_image(content: String, file_path: String) {
if let Ok(file) = File::create(file_path) {
let mut writer = BufWriter::new(file);
if let Err(e) = writer.write(content.as_bytes()) {
println!("写出失败:{:#}", e)
}
} else {
println!("PPM保存失败")
}
}