Fix output image size bug