1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
use std::io::Write; use std::path::Path; use naut_core::image; use crate::conversion::{AutomaticColorTypeAdjustment, ConversionWriter}; use crate::errors::SicIoError; pub fn export<W: Write>( image: &image::DynamicImage, writer: &mut W, format: image::ImageOutputFormat, export_settings: ExportSettings, ) -> Result<(), SicIoError> { let conv = ConversionWriter::new(image); conv.write(writer, format, export_settings.adjust_color_type) } #[derive(Debug)] pub struct ExportSettings { pub adjust_color_type: AutomaticColorTypeAdjustment, } pub struct EmptyPath; impl AsRef<Path> for EmptyPath { fn as_ref(&self) -> &Path { Path::new("") } }