add some code to fixup the size of the image, and make the img file usable directly