'Get min/max values for each band in the image'

def _getextrema(self):

    def minmax(histogram):
        n = 255
        x = 0
        for i in range(256):
            if histogram[i]:
                n = min(n, i)
                x = max(x, i)
        return (n, x)
    v = []
    for i in range(0, len(self.h), 256):
        v.append(minmax(self.h[i:]))
    return v
