Closed gedw99 closed 1 month ago
I just saw that this code is already designed to compile to wasm.
But odes it allow passing in the images as byte array though ?
--
For example:
https://kornel.ski/dssim shows that the image is passed in by ref.
I need to pass in as bytes because WASM environment can't use file system or network. Is that currently designed for ?
The command-line version that takes PNG/JPEG files is not supported in WASM.
The library interface of https://docs.rs/dssim-core/latest/dssim_core/ is supported in WASM. It's up to you how to load images. The library takes raw pixels:
https://docs.rs/dssim-core/latest/dssim_core/struct.Dssim.html#method.create_image_rgba
There are no bindings for JS - you'll need to make your own Rust library that computes what you want, and make your own WASM bindings for JS in there.
Right .. thats @kornelski
I am not great at rust, and can't work out how to do that.
@gedw99 You can try this project, which is a port version of this project.
Would make it easier for me to use if I can compile it as wasm.
Anyone know how to do that ? Am not a rust expert but with rust I think it’s pretty easy by adding the right wasm export annotations to the rust functions we want exported.
then I can use it as part of a bigger system.
the wasm host runner will need to feed each image in as a byte array or similar because the wasm guest ( the rust code ) does not have access to the file system or network.