Store the combined image into a tempfile so we can optimize it _before_ writing it to the proper path.

This ensure that Thor can compare the images properly and it won't replace any
image that didn't changed.