Compress images using optim parameter

Closes #6

LGTMs by:
* Michael
* Benson