2025-06-27 02:31:23 +01:00
|
|
|
use image::DynamicImage;
|
|
|
|
|
|
|
|
|
|
use crate::image_to_ansi::nu_plugin::IntoAnsiParams;
|
|
|
|
|
|
|
|
|
|
use super::{make_ansi, string_writer::StringWriter};
|
|
|
|
|
|
2025-10-19 00:05:16 +01:00
|
|
|
pub fn to_ansi(img: &DynamicImage, config: &IntoAnsiParams) -> String {
|
2025-06-27 02:31:23 +01:00
|
|
|
let stdout = &mut StringWriter::new();
|
|
|
|
|
let _ = make_ansi(stdout, img, config);
|
|
|
|
|
|
|
|
|
|
// if config.restore_cursor {
|
|
|
|
|
// execute!(&mut stdout, RestorePosition)?;
|
|
|
|
|
// };
|
|
|
|
|
|
2025-10-19 00:05:16 +01:00
|
|
|
stdout.read().to_string()
|
2025-06-27 02:31:23 +01:00
|
|
|
}
|