diff --git a/crate/src/native.rs b/crate/src/native.rs index 1b1671f..c7cf47b 100644 --- a/crate/src/native.rs +++ b/crate/src/native.rs @@ -4,6 +4,7 @@ use image::DynamicImage::ImageRgba8; use image::{GenericImageView, ImageBuffer}; use std::io; +use std::path::Path; // use wasm_bindgen::prelude::*; use crate::PhotonImage; use thiserror::Error; @@ -31,7 +32,10 @@ pub enum Error { /// /// // ... image editing functionality here ... /// ``` -pub fn open_image(img_path: &str) -> Result { +pub fn open_image

(img_path: P) -> Result +where + P: AsRef, +{ let img = image::open(img_path)?; let (width, height) = img.dimensions(); @@ -87,7 +91,10 @@ pub fn open_image_from_bytes(buffer: &[u8]) -> Result { /// // Save the image at the given path. /// save_image(img,"manipulated_image.jpg").expect("Save failed"); /// ``` -pub fn save_image(img: PhotonImage, img_path: &str) -> Result<(), Error> { +pub fn save_image

(img: PhotonImage, img_path: P) -> Result<(), Error> +where + P: AsRef, +{ let raw_pixels = img.raw_pixels; let width = img.width; let height = img.height;