'Extract the horizontal and vertical dots-per-inch value from the APP1
header at *offset* in *stream*.'

@classmethod
def from_stream(cls, stream, marker_code, offset):

    segment_length = stream.read_short(offset)
    if cls._is_non_Exif_APP1_segment(stream, offset):
        return cls(marker_code, offset, segment_length, 72, 72)
    tiff = cls._tiff_from_exif_segment(stream, offset, segment_length)
    return cls(marker_code, offset, segment_length, tiff.horz_dpi, tiff.vert_dpi)
