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 #148

Open
gedw99 opened this issue Nov 12, 2023 · 3 comments
Open

Wasm #148

gedw99 opened this issue Nov 12, 2023 · 3 comments

Comments

@gedw99
Copy link

gedw99 commented Nov 12, 2023

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.

@gedw99
Copy link
Author

gedw99 commented Nov 12, 2023

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 ?

@kornelski
Copy link
Owner

kornelski commented Nov 13, 2023

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.

@gedw99
Copy link
Author

gedw99 commented Nov 15, 2023

Right .. thats @kornelski

I am not great at rust, and can't work out how to do that.

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

No branches or pull requests

2 participants