Improved loading, painting and resizing of images.