You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] An error occurs when using the codecs in NodeJs #18
I assume I am completely using this library in the wrong way.
Because the wasm index.js file only contains 1 statement (throw new Error('todo!');):
And even if would have passed through that point, then further on I would have got the same exception a bit further in the code (whether I set the environment variable or not doesn't matter):
My creativity has reached its limit. Hopefully you can illuminate me ;-)
The ImageScript codecs currently don't include a WASM implementation (it's still WIP), so i'm not sure if it will work with node-red (not sure if it would be running server side or in a node-red dashboard (client side)). It would have to run on a supported platform
() with the native modules (./codecs/node/index.js), but accessing those directly isn't really supported (or documented) right now.
The ImageScript codecs currently don't include a WASM implementation (it's still WIP)
Ah I wasn't aware of that. Because from the benchmarks on the readme page, I had concluded that WASM was already implemented for encoding and decoding... I am certainly not going to ask an open-source developer for an ETA ;-). But is this something you are working on, or is in the category 'maybe later maybe never'? In the latter case, I need to look for another solution? Which would be a pity, because I don't think there is another wasm solution ...
not sure if it would be running server side or in a node-red dashboard (client side)
Are you familiar with Node-RED somehow?
I would like to use this on the server side. Currently almost all image processing nodes in Node-RED handle their own encoding/decoding (mostly with jpeg-js). Although that is a very nice library, I have two problems with it:
It is just too slow when you want to do video surveillance with a bunch of cameras.
If every node does decode -> image processing --> encode, then a lot of cpu is being wasted because you get a series of decodings and encodings after each other.
I had hoped to develop a new node that could decode/encode images based on your library and wasm. So I first would decode the jpegs to raw images, then add multiple nodes in a chain that do processing on that raw image, and at the end a node to encode the (processed) raw images back to a jpeg:
This way we would only have one decoding, and one encoding. And both based on wasm for better performance.
Do you think something like that is a bit realistic? Because I would like to avoid native libraries (like sharp....), because when you e.g. run Node-RED in an (Alpine Linux Docker) there aren't even build tools available. So wasm would be a great alternative ...
codecs package wasm support is blocked by ongoing imagescript port to rust
for now you can vendor in and modify our current wasm jpeg encoder/decoder to fit your needs
Fixed in 3.0.0: ImageScript no longer ships any WebAssembly or native binaries. Every codec is plain TypeScript, so there’s nothing to load, bundle or compile per platform, and it runs on Alpine/musl, in bundled serverless functions, Deno, Bun and browsers. npm install imagescript@3; see the changelog for breaking changes.
Activity
bartbutenaers commentedon Jan 7, 2022
I assume I am completely using this library in the wrong way.
Because the wasm index.js file only contains 1 statement (
throw new Error('todo!');):And even if would have passed through that point, then further on I would have got the same exception a bit further in the code (whether I set the environment variable or not doesn't matter):
My creativity has reached its limit. Hopefully you can illuminate me ;-)
bartbutenaers commentedon Jan 7, 2022
Ok it seems to work when I don't use
@imagescript/codecsdirectly, but instead theimagescriptwhich also seems to contain the codecs.@imagescript/codecsis not to be meant to use as a standalone library?process.env['CODECS_FORCE_WASM'] = 1;before I load imagescript?Thanks!!
matmen commentedon Jan 7, 2022
The ImageScript codecs currently don't include a WASM implementation (it's still WIP), so i'm not sure if it will work with node-red (not sure if it would be running server side or in a node-red dashboard (client side)). It would have to run on a supported platform
) with the native modules (
(
./codecs/node/index.js), but accessing those directly isn't really supported (or documented) right now.bartbutenaers commentedon Jan 7, 2022
Hi @matmen,
Thanks for your quick response!!
Ah I wasn't aware of that. Because from the benchmarks on the readme page, I had concluded that WASM was already implemented for encoding and decoding... I am certainly not going to ask an open-source developer for an ETA ;-). But is this something you are working on, or is in the category 'maybe later maybe never'? In the latter case, I need to look for another solution? Which would be a pity, because I don't think there is another wasm solution ...
Are you familiar with Node-RED somehow?
I would like to use this on the server side. Currently almost all image processing nodes in Node-RED handle their own encoding/decoding (mostly with jpeg-js). Although that is a very nice library, I have two problems with it:
I had hoped to develop a new node that could decode/encode images based on your library and wasm. So I first would decode the jpegs to raw images, then add multiple nodes in a chain that do processing on that raw image, and at the end a node to encode the (processed) raw images back to a jpeg:
This way we would only have one decoding, and one encoding. And both based on wasm for better performance.
Do you think something like that is a bit realistic? Because I would like to avoid native libraries (like sharp....), because when you e.g. run Node-RED in an (Alpine Linux Docker) there aren't even build tools available. So wasm would be a great alternative ...
evanwashere commentedon Jan 11, 2022
codecs package wasm support is blocked by ongoing imagescript port to rust
for now you can vendor in and modify our current wasm jpeg encoder/decoder to fit your needs
AndreKR commentedon Aug 15, 2023
@bartbutenaers Are you currently using ImageScript successfully with Node-RED? Can you offer any guidance in my issue #30?
bartbutenaers commentedon Aug 16, 2023
@AndreKR,
Unfortunately - due to lack of free time - I did not continue with this.
Bart
AndreKR commentedon Aug 16, 2023
@bartbutenaers You might be interested to hear that Node-RED has recently introduced Debian-based images and ImageScript works fine with them.
matmen commentedon Oct 14, 2026
Fixed in 3.0.0: ImageScript no longer ships any WebAssembly or native binaries. Every codec is plain TypeScript, so there’s nothing to load, bundle or compile per platform, and it runs on Alpine/musl, in bundled serverless functions, Deno, Bun and browsers. npm install imagescript@3; see the changelog for breaking changes.