compact the images