Images in strings and Base64

Images can be saved as strings encoded using Base64. This can be quite useful. For example, you can pass such strings from a server to your app, or store them in an SQLite database. Here’s an example of a png file with an image of a red dot, represented as a string:

reddot="data:Image/png;base64,"
reddot=reddot & "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGP"
reddot=reddot & "C/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YGARc5KB0XV+IA"
reddot=reddot & "AAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAF1J"
reddot=reddot & "REFUGNO9zL0NglAAxPEfdLTs4BZM4DIO4C7OwQg2JoQ9LE1exdlYvBBeZ7jq"
reddot=reddot & "ch9//q1uH4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6MJpcq2MLaI97CER3N0"
reddot=reddot & "vr4MkhoXe0rZigAAAABJRU5ErkJggg=="

To display in an Image Control, do this:
Image1.innerHTML="<img height=10 width=10 src='" & reddot & "'/>"

To display in the PictureBox control: do this:
reddotImg=new Image()
reddotImg.src=reddot
pb = PictureBox1.getContext("2d")

Function redditImg_onload()
  pb.drawImage(reddotImg,0,0)
End Function

You can save a Picturebox to a string using the PictureBox.toDataURL() function.