Java Extension returns a Bitmap(img) as a Byte[] as a String and in GM change it back to sprite.How?

Hi, so I have a java extension( java code: ). It has 1 function and the function have 1 argument that is a String called fname. And it returns a String. The function should get the file from the path of fname and if it's an image file, get it as a Bitmap. then I change the Bitmap to a byte array( byte[] ) and then the byte array to String and returns it.

The Extension works fine, but my problem is that I don't know how to change the String variable the function returns to a byte array and the byte array to sprite or paste it on a surface.

(Im using GMS2 and the extension is for Android)

So can anybody with some knowledge about that kind of stuff can help me with that? Thanks!

So I managed to add the Output String into a buffer and draw it but this is how it turns out compared to the original image: image

Tho if I make a new sprite, draw the sprite to a surface and gets the bitmap of the surface to the buffer, it turns out fine...

This is the code I used: (The load_image function is the function of the java extension) (The draw_buffer function is a function that uses this extension's functions and should draw the buffer)

Maybe it's because of the buffer_getpixel extension? What can I use to replace it?