Writing an image produces an octet stream #62
Unanswered
Vasia-Assembler
asked this question in
Q&A
Replies: 2 comments 1 reply
-
Can you share a bit of sample code that demonstrates what you are doing? I am having trouble to understand your question, |
Beta Was this translation helpful? Give feedback.
1 reply
-
The 'data' buffer will be gone at some point after the method has returned because that buffer is on a separate buffer that will be freed after the method returns. So you will need to make a copy of that 'data' buffer. You will need to do something like this: const a = new Promise<Uint8Array>((resolve) => {
ImageMagick.read(view, (img) => {
img.autoOrient()
img.write((data) => {
const output = new Uint8Array(data);
resolve(output);
}, MagickFormat.Png)
})
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi. I've found that writing some images behave strangely. The attached image, when written as PNG (well I suppose it's okay to ignore the fact that the source is a PNG already), is identified by wasmagic as application/octet-stream, while if written as JPG, identified correctly as image/jpeg. When written as WEBP, it's also identified as application/octet-stream. How can I deal with this?
P.S The image is above. It's invisible, but contains alpha information.
Beta Was this translation helpful? Give feedback.
All reactions