Make image loading code common for JS and GL.
Ensure images are always scaled to canvas size.