Reputation: 1
I am getting an image (encoded in base64 string format) from a server. This base64-encoded string has to be converted back to image. I am doing in two steps:
Convert the base64 encoded string into a buffer - Using bits -> string to buffer(string,"base64")
Write the buffer into a picture (of same dimensions) - Using Picture -> write buffer(buffer) and then I'm displaying the picture.
The base64 string from the server (whole string):
iVBORw0KGgoAAAANSUhEUgAAAJEAAAAeCAYAAAAsPvwuAAAAmUlEQVR42u3SQQoAIQgAwL7h/x+6sQsLHcqCPI7QITGNmvYsIiK+leX+/ZjPcifnsnvs5pzW3PaunLGrm/W6eZPqv3yjQQQRRBBBBBFEEEEEEUQQQQQRRBBBBBFEEEEEEUQQQQQRRBBBBBFEEEEEEUQQQQQRRBBBBBFEEEEEEUQQQQQRRBBBBBFEEEEEEUQQQQQRRBBBVIuoAwQlLkAhgPjNAAAAAElFTkSuQmCC
The problem is: I am not getting the desired image when I display it on the wall. It just shows a very small image.
So I tried finding what string TouchDevelop expected in bits -> string to buffer(string,"base64") method.
The base64 string I got from TouchDevelop (just a small part of actual string - Actual string size-23,300 chars):
////////////////////////////////GRkZ/xkZGf////////////////8ZGRn/GRkZ////////////GRkZ/xkZGf8ZGRn/GRkZ//////8ZGRn/GRkZ/xkZGf8ZGRn//////xkZGf8ZGRn///////////8ZGRn/GRkZ/xkZGf8ZGRn//////xkZGf8ZGRn//////////////////////xkZGf8ZGRn//////xkZGf8ZGRn//////xkZGf8ZGRn/GRkZ/xkZGf///////////xkZGf8ZGRn//////xkZGf8ZGRn/GRkZ/xkZGf//////////////////////GRkZ/xkZGf//////GRkZ/xkZGf//////GRkZ/xkZGf8ZGRn/GRkZ////////////GRkZ/xkZGf8ZGRn/GRkZ//////8ZGRn/GRkZ/xkZGf8ZGRn//////////////////////xkZGf8ZGRn//////xkZGf8ZGRn//////xkZGf8ZGRn///////////8ZGRn/GRkZ//////8ZGRn/GRkZ//////////////////////8ZGRn/GRkZ/xkZGf8ZGRn//////xkZGf8ZGRn//////xkZGf8ZGRn/GRkZ/xkZGf///////////xkZGf8ZGRn////////////////……
As you might have noticed, the base64 string from the server and the base64 string what TouchDevelop expects to show the correct image have a huge difference. And this is resulting into displaying of an incorrect image. I am stuck in this problem for a few days. Is there a bug? If not, can anyone help me with this problem?
Upvotes: 0
Views: 52