python again

This commit is contained in:
Chris Tsang
2023-09-16 17:59:52 +01:00
parent 79dd451da1
commit f5cce867f2

View File

@@ -1,11 +1,12 @@
use crate::*;
use pyo3::prelude::*;
use visioncortex::{PathSimplifyMode};
use super::converter::*;
use std::path::PathBuf;
use visioncortex::PathSimplifyMode;
/// Python binding
#[pyfunction]
fn convert_image_to_svg_py( image_path: &str,
fn convert_image_to_svg_py(
image_path: &str,
out_path: &str,
colormode: Option<&str>, // "color" or "binary"
hierarchical: Option<&str>, // "stacked" or "cutout"
@@ -17,7 +18,7 @@ fn convert_image_to_svg_py( image_path: &str,
length_threshold: Option<f64>, // in [3.5, 10] default: 4.0
max_iterations: Option<usize>, // default: 10
splice_threshold: Option<i32>, // default: 45
path_precision: Option<u32> // default: 8
path_precision: Option<u32>, // default: 8
) -> PyResult<()> {
let input_path = PathBuf::from(image_path);
let output_path = PathBuf::from(out_path);
@@ -68,7 +69,6 @@ fn convert_image_to_svg_py( image_path: &str,
..Default::default()
};
convert_image_to_svg(config).unwrap();
Ok(())
}