1

One can think at first at the base64 encoding, and base64 data-uri.

But is it the most space efficient solution?

My use case is to store tiny captcha images aside clickable links, which are gif or png files, 500-2000 bytes in size, somehow embedded in the utf8 HTML source.

I am thinking of data- attributes of the clickable links to store the appropriately encoded image data. Then I would like to use JavaScript to decode the embedded image into a dinamically set base64 data-uri.

Konstantin
  • 2,983
  • 3
  • 33
  • 55

1 Answers1

1

From the Ascii85 Wiki:

Ascii85, also called Base85, is a form of binary-to-text encoding developed by Paul E. Rutter for the btoa utility. By using five ASCII characters to represent four bytes of binary data (making the encoded size ​1⁄4 larger than the original, assuming eight bits per ASCII character), it is more efficient than uuencode or Base64, which use four characters to represent three bytes of data (​1⁄3 increase, assuming eight bits per ASCII character).

Beware, JavaScript's btoa (atob) is Base64.

greg-tumolo
  • 698
  • 1
  • 7
  • 30