convert base64 PNG to Image object
how do i convert in microstudio base64 PNG to image object?
how do i convert in microstudio base64 PNG to image object?
PNG probably has compression, so if assigning data via image.canvas.src doesn't work, you'd have to implement decompression.
It'll be easier to read data pixel by pixel. Save to string and read it back in your data format of your choice.
https://microstudio.io/i/Loginus/fastrgb/
You can draw pixels using the setRGB function.
Or write directly to the DATA structure (it will be faster).
I know that you can transfer graphics between MicroStudio and PIXI and M2D - here are examples.
https://microstudio.dev/i/TinkerSmith/m2danim/
https://microstudio.dev/i/TinkerSmith/pixianim/
For some reason, passing data in Base64 format to image.canvas.src doesn't work - I don't know why. Maybe someone will find a solution.
Neither HTMLCanvasElement.prototype.src
nor CanvasRenderingContext2D.prototype.src
are properties, so you have to create a JavaScript Image (HTMLImageElement) and set its src
to the data URL. Then, you can draw the image to a msImage's canvas.