@staticmethod
def _find_needle(image, lower, upper, threshold=5):
    """
        Determines and extracts the top area of the lower image that we will
        try to find in the upper one.

        This method exists to attempt to eradicate the unreliable situation
        where we are determining where to stitch based on areas of the images
        which lack text.

        :param image: The second image in the join pair.
        :param lower: The minimum height of the needle area.
        :param upper: The maximum height of the needle area.
        :param threshold: The minimum number of unique colours a viable match
                          area contains.
        :return: The decided needle image.
        """
    assert lower <= upper <= image.height
    for offset in range(lower, upper + 1):
        crop = image.crop((0, 0, image.width, offset))
        if not crop.getcolors(threshold - 1):
            return crop
    return image.crop((0, 0, image.width, upper))
