JPG vs BMP vs PNG vs GIF
Here is the base64 encoded results of each image:
.jpg - From a 539 byte file
.bmp - From a 126 byte file
.png - From a 69 byte file
.gif - From a 35 byte file
Based on these results it is clear that a 1 pixel gif image is the most efficient format for base64 encoding data.
I conducted a further study of the efficiency of these image formats by generating a series of images of each type ranging from 1 pixel to 2000 pixels and skipping by increments of 200. To make the testing go quicker, I created a script in Python that generates a set of images and logs their file size and dimensions. My script also generates a graph based on these logs to help visualize the data.
If your interested seeing the code or generating the logs for yourself you can download the script from https://gist.github.com/gunthercox/9874531.
For this graph, the horizontal axis is the physical dimensions of the file, and the vertical axis is the file size.
.jpeg = red
.bmp = black
.png = green
.gif = blue
The data from the logs shows that the png to be on average the most efficient format. Jpegs and gifs have very close performance for smaller images but jpegs quickly increase in size for larger images. Bitmap images (.bmp) were surprisingly inefficient and while all these formats had very close sizes for a 1 pixel image file, the bmp image grew tremendously larger as the size of the file was increased.