How to encode images within HTML?
===

How can you encode a background image within your HTML, example:

    background-image: url(data:image/gif;base64,XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX);

If i have an image file, how can I encode its contents and then convert it to a string?

Is this the same thing those custom font services do?