Skip to content

Commit

Permalink
Merge pull request silvia-odwyer#172 from Sellig6792/master
Browse files Browse the repository at this point in the history
Make it not require a specific version of dependency "wasm-bindgen"
  • Loading branch information
silvia-odwyer authored Apr 20, 2024
2 parents 8daee83 + 2da0c7e commit 4dafcc6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ react_app_demo/package-lock.json
photon-docs/site
output*.jpg
output*.png
.vscode
.vscode

# Jetbrains IDE
.idea/
3 changes: 2 additions & 1 deletion crate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ imageproc = { version = "0.23.0", default-features = false }
rusttype = "0.9.2"
base64 = "0.13.0"
time = "0.3.21"
wasm-bindgen = { version = "=0.2.85", optional = true }
wasm-bindgen = { version = "0.2.92", optional = true }
serde = { version = "1.0", features = ["derive"] }
thiserror = "1.0"
js-sys = { version = "0.3.62", optional = true }
node-sys = { version = "0.4.2", optional = true }
perlin2d = "0.2.6"
instant = "0.1.12"

# The `console_error_panic_hook` crate provides better debugging of panics by
# logging them with `console.error`. This is great for development, but requires
Expand Down
5 changes: 2 additions & 3 deletions crate/examples/example.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
extern crate image;
extern crate photon_rs as photon;
extern crate time;
use time::Instant;
use instant::Instant;

fn main() -> Result<(), Box<dyn std::error::Error>> {
// Replace the variable file_name with whatever image you would like to apply filters to
Expand All @@ -26,7 +25,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let end = Instant::now();
println!(
"Took {} seconds to {} image.",
(end - start).as_seconds_f64(),
(end - start).as_secs_f64(),
effect
);
}
Expand Down
9 changes: 5 additions & 4 deletions crate/examples/seam_carver.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
extern crate image;
extern crate photon_rs;
extern crate time;

use instant::Instant;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let file_name = "crate/examples/input_images/daisies_fuji.jpg";
println!("file name = {}", file_name);

// // Open the image
let img = photon_rs::native::open_image(file_name)?;
let start = time::Instant::now();
let start = Instant::now();
// Seam Carver
let (w, h) = (img.get_width(), img.get_height());
println!("original = w: {}, h: {}", w, h);
Expand All @@ -19,10 +20,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {

// Write the contents of this image in JPEG format.
photon_rs::native::save_image(res, "output_seam_carver.jpg")?;
let end = time::Instant::now();
let end = Instant::now();
println!(
"Took {} seconds to seam carve image.",
(end - start).as_seconds_f64()
(end - start).as_secs_f64()
);

Ok(())
Expand Down
4 changes: 2 additions & 2 deletions crate/src/bin/bin.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
extern crate photon_rs;
extern crate time;

use instant::Instant;
use photon_rs::channels::alter_red_channel;
use photon_rs::native::{open_image, save_image};
use time::Instant;

fn main() -> Result<(), Box<dyn std::error::Error>> {
// Open the image (a PhotonImage is returned)
Expand All @@ -20,7 +20,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let end = Instant::now();
println!(
"Took {} seconds to increment red channel by 40 on image.",
(end - start).as_seconds_f64()
(end - start).as_secs_f64()
);

println!(
Expand Down

0 comments on commit 4dafcc6

Please sign in to comment.