Do not leak TIFF file descriptor on error.
Use the resolution from the TIFF file, instead of estimating it.

The resolution is still estimated if the tiff file does not
contain the information.
Add function that is used by the annotate script.
Guard against None rotation (fallback to False)