compact the image