use noise::utils::{NoiseImage, NoiseMap};

#[allow(dead_code)]
pub fn write_example_to_file(map: &NoiseMap, filename: &str) {
    use std::{fs, path::Path};

    let target = Path::new(filename);

    fs::create_dir_all(target.parent().expect("No parent directory found."))
        .expect("Failed to create directories.");

    map.write_to_file(target)
}

#[allow(dead_code)]
pub fn write_image_to_file(image: &NoiseImage, filename: &str) {
    use std::{fs, path::Path};

    let target = Path::new(filename);

    fs::create_dir_all(target.parent().expect("No parent directory found."))
        .expect("Failed to create directories.");

    image.write_to_file(target)
}
