Closed lancejpollard closed 9 months ago
I've also noticed that it is failing randomly on some PNG images converted to JPG, but that is a different issue.
You cannot use the image outside the scope of the read method.
@dlemstra mind elaborating on that further, I have never seen such a situation before :)
Sorry for not adding more context. The reason this is not possible is because of the native code behind this project. The memory that is used for the image is freed after the method has been executed.
Are there other things like that to be aware of in the codebase?
When you are getting the value inside a delegate and not as a return value you should not use it ouside that delegate.
magick-wasm version
0.0.28
Description
I got this package to work temporarily by manually copying the build files to the public directory, and going from there FYI.
But now I'm stumped.
This one works fine, with the
callback
:This one returns an
image
but fails silently:I am basically trying to do this in my code:
But the
out
is an emby ArrayBuffer in the end, **only if I call it through thisPromise
technique. If I call i t through thecallback
version of the function, IT WORKS!I can only imagine why that might occur. All I can imagine is that because I've wrapped the call in a
Promise
, the imagemagick-wasm code is CHECKING for wrapping in a promise and acts differently based on that. Somehow, some super meta programming? I don't understand why it wouldn't work if I wrap it in a promise? Maybe a polyfill bug or something strange... Any ideas?Steps to Reproduce
Try calling the
read
function when it's wrapped in a promise with async/await like I have it above.Images
Here is a picture of my logs on the
out
variable when passed through thePromise
.