fix memory spikes by compressing images