downsample the image to improve rendering performance