Bug 1029763 - The contact thumbnail scaling is terrible, all jagged

I have made the modifications requested. The advantage of this patch is that now we can make it configurable the output format for the thumbnails, thus if we find out that lossless png is more efficient in terms of space, we can switch to it easily. Definetely something to look into