Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it not require a specific version of dependency "wasm-bindgen" #172

Merged
merged 2 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading