Another attempt to catch out of memory errors for images.