Fix initial image size calculation, limit to image size
Fix final image rendering