sarpro/api/
save_image.rs

1//! Typed save helper for single-band arrays
2
3use std::path::Path;
4use ndarray::Array2;
5use crate::core::processing::save::save_processed_image;
6use crate::error::{Error, Result};
7use crate::io::sentinel1::SafeMetadata;
8use crate::types::{AutoscaleStrategy, BitDepth, OutputFormat, ProcessingOperation};
9
10/// Typed save helper for single-band arrays
11pub fn save_image(
12    processed: &Array2<f32>,
13    output: &Path,
14    format: OutputFormat,
15    bit_depth: BitDepth,
16    target_size: Option<usize>,
17    metadata: Option<&SafeMetadata>,
18    pad: bool,
19    autoscale: AutoscaleStrategy,
20    operation: ProcessingOperation,
21) -> Result<()> {
22    save_processed_image(
23        processed,
24        output,
25        format,
26        bit_depth,
27        target_size,
28        metadata,
29        pad,
30        autoscale,
31        operation,
32    )
33    .map_err(|e| Error::external(e))
34}