Encode images as base64 to avoid tainting the canvas--also simplifies loading callbacks, see #309