Avoid out-of-memory crashes caused by HUGE images