reduce image size when running in an out of memory error