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)
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.
@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)
@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"] }
This seems to be resolved to the author's expectations, judging by the reaction. I'm going to close this.
Most helpful comment
@acidicX the
Cargo.tomlfor the image crate is specifically written so that you can disable the feature in your ownCargo.toml. Specifically, "jpeg_rayon" is an option feature on this crate that is enabled by default but can be turned off by passing: