The author had built something like this image viewer before and used an existing library to handle some of the rendering.