"Hugs" the rasterized image
The returned image now removes empty space, which mean that the
targetSize sent in is a maximum size. Maybe we should rename that?

This can probably me optimized, I just wanted to see if I could make it
work.