def get_extent(ds):
    """ Returns the bounding box of tiff image. """
    geo_t = ds.GetGeoTransform()
    x_size, y_size = ds.RasterXSize, ds.RasterYSize
    xmin = min(geo_t[0], geo_t[0] + x_size * geo_t[1])
    xmax = max(geo_t[0], geo_t[0] + x_size * geo_t[1])
    ymin = min(geo_t[3], geo_t[3] + y_size * geo_t[5])
    ymax = max(geo_t[3], geo_t[3] + y_size * geo_t[5])
    return xmin, xmax, ymin, ymax