x, y, center = bounds if x < y: x = 0 y = center else: y = 0 x = center cropped = copy.subpixbuf(x, y, THUMB_SIZE, THUMB_SIZE)