A (horz_dpi, vert_dpi) 2-tuple specifying the dots-per-inch
        resolution of this image. A default value of (72, 72) is used if the
        dpi is not specified in the image file.

def dpi(self):
        """
        A (horz_dpi, vert_dpi) 2-tuple specifying the dots-per-inch
        resolution of this image. A default value of (72, 72) is used if the
        dpi is not specified in the image file.
        """
        def int_dpi(dpi):
            """
            Return an integer dots-per-inch value corresponding to *dpi*. If
            *dpi* is |None|, a non-numeric type, less than 1 or greater than
            2048, 72 is returned.
            """
            try:
                int_dpi = int(round(float(dpi)))
                if int_dpi < 1 or int_dpi > 2048:
                    int_dpi = 72
            except (TypeError, ValueError):
                int_dpi = 72
            return int_dpi

        def normalize_pil_dpi(pil_dpi):
            """
            Return a (horz_dpi, vert_dpi) 2-tuple corresponding to *pil_dpi*,
            the value for the 'dpi' key in the ``info`` dict of a PIL image.
            If the 'dpi' key is not present or contains an invalid value,
            ``(72, 72)`` is returned.
            """
            if isinstance(pil_dpi, tuple):
                return (int_dpi(pil_dpi[0]), int_dpi(pil_dpi[1]))
            return (72, 72)

        return normalize_pil_dpi(self._pil_props[2])