Add validation on generate image if size is zero