Write image to tmp folder