Compress to a target size

Compress an image or PDF to fit a size limit, e.g. under 2 MB for email.