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

WASM support: JPEG import panics because rayon is not supported yet #879

Closed
acidicX opened this issue Mar 7, 2019 · 4 comments
Closed

Comments

@acidicX
Copy link

acidicX commented Mar 7, 2019

I'm getting the following panic on a WebAssembly (WASM) binary when trying to load a JPG image from memory image::load_from_memory with rust v1.35:

panicked at 'called `Result::unwrap()` on an `Err` value: ThreadPoolBuildError { kind: IOError(Custom { kind: Other, error: StringError("operation not supported on wasm yet") }) }', src/libcore/result.rs:997:5

PNG and GIF works.

Would it be possible to include a switch in the image::load_from_memory API that disables rayon in the JPEG decoder? So we could work around this until rayon fully supports WASM as well.

(related: #703)

@jashephe
Copy link

Not sure if this is the same issue that you're having, but I was encountering a similar issue with using image in WASM that I resolved by disabling the "jpeg_rayon" feature.

@acidicX
Copy link
Author

acidicX commented Mar 12, 2019

@jashephe cool, thanks for the hint. But I cannot override this in my own Cargo.toml, right? Right now I'm using the image crate. So I would have to remove it in image's Cargo.toml and build image myself?
(sorry, still a bit of a n00b in Rust)

@fintelia
Copy link
Contributor

@acidicX the Cargo.toml for the image crate is specifically written so that you can disable the feature in your own Cargo.toml. Specifically, "jpeg_rayon" is an option feature on this crate that is enabled by default but can be turned off by passing:

image = { version = "0.21.0", default-features = false, features = ["jpeg"] } 

@HeroicKatora
Copy link
Member

This seems to be resolved to the author's expectations, judging by the reaction. I'm going to close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants