mirror of
https://github.com/visioncortex/vtracer.git
synced 2025-12-07 01:26:12 -08:00
python again
This commit is contained in:
@@ -1,11 +1,12 @@
|
|||||||
|
use crate::*;
|
||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
|
use std::path::PathBuf;
|
||||||
use visioncortex::{PathSimplifyMode};
|
use visioncortex::PathSimplifyMode;
|
||||||
use super::converter::*;
|
|
||||||
|
|
||||||
/// Python binding
|
/// Python binding
|
||||||
#[pyfunction]
|
#[pyfunction]
|
||||||
fn convert_image_to_svg_py( image_path: &str,
|
fn convert_image_to_svg_py(
|
||||||
|
image_path: &str,
|
||||||
out_path: &str,
|
out_path: &str,
|
||||||
colormode: Option<&str>, // "color" or "binary"
|
colormode: Option<&str>, // "color" or "binary"
|
||||||
hierarchical: Option<&str>, // "stacked" or "cutout"
|
hierarchical: Option<&str>, // "stacked" or "cutout"
|
||||||
@@ -17,8 +18,8 @@ fn convert_image_to_svg_py( image_path: &str,
|
|||||||
length_threshold: Option<f64>, // in [3.5, 10] default: 4.0
|
length_threshold: Option<f64>, // in [3.5, 10] default: 4.0
|
||||||
max_iterations: Option<usize>, // default: 10
|
max_iterations: Option<usize>, // default: 10
|
||||||
splice_threshold: Option<i32>, // default: 45
|
splice_threshold: Option<i32>, // default: 45
|
||||||
path_precision: Option<u32> // default: 8
|
path_precision: Option<u32>, // default: 8
|
||||||
) -> PyResult<()> {
|
) -> PyResult<()> {
|
||||||
let input_path = PathBuf::from(image_path);
|
let input_path = PathBuf::from(image_path);
|
||||||
let output_path = PathBuf::from(out_path);
|
let output_path = PathBuf::from(out_path);
|
||||||
|
|
||||||
@@ -68,7 +69,6 @@ fn convert_image_to_svg_py( image_path: &str,
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
convert_image_to_svg(config).unwrap();
|
convert_image_to_svg(config).unwrap();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user