Fix usage of detected resolution.

Well, turns out I did the if the wrong way around, and the correct
resolution from the tiff was not used. On top of that, the centering
was not correct either.