docs: def slow_highlight(img1, img2, opts):
      """Try to find similar areas between two images.
  
      Produces two masks for img1 and img2.
  
      The algorithm works by comparing every possible alignment of the images,
      smoothing it a bit to reduce spurious matches in areas that are
      perceptibly different (e.g. text), and then taking the point-wise minimum
      of all those difference maps.
  
      This way if you insert a few pixel rows/columns into an image, similar
      areas should match even if different areas need to be aligned with
      different shifts.
  
      As you can imagine, this brute-force approach can be pretty slow, if
      there are many possible alignments.  The closer the images are in size,
      the faster this will work.
  
      If would work better if it could compare alignments that go beyond the
      outer boundaries of the images, in case some pixels got shifted closer
      to an edge.
      """
      w1, h1 = img1.size
      w2, h2 = img2.size
      W, H = max(w1, w2), max(h1, h2)
  
      pimg1 = Image.new('RGB', (W, H), opts.bgcolor)
      pimg2 = Image.new('RGB', (W, H), opts.bgcolor)
  
      pimg1.paste(img1, (0, 0))
      pimg2.paste(img2, (0, 0))
  
      diff = Image.new('L', (W, H), 255)
      # It is not a good idea to keep one diff image; it should track the
      # relative positions of the two images.  I think that's what explains
      # the fuzz I see near the edges of the different areas.
  
      xr = abs(w1 - w2) + 1
      yr = abs(h1 - h2) + 1
  
      try:
          p = Progress(xr * yr, timeout=opts.timeout)
          for x in range(xr):
              for y in range(yr):
                  p.next()
                  this = ImageChops.difference(pimg1, pimg2).convert('L')
                  this = this.filter(ImageFilter.MaxFilter(7))
                  diff = ImageChops.darker(diff, this)
                  if h1 > h2:
                      pimg2 = ImageChops.offset(pimg2, 0, 1)
                  else:
                      pimg1 = ImageChops.offset(pimg1, 0, 1)
              if h1 > h2:
                  pimg2 = ImageChops.offset(pimg2, 0, -yr)
              else:
                  pimg1 = ImageChops.offset(pimg1, 0, -yr)
              if w1 > w2:
                  pimg2 = ImageChops.offset(pimg2, 1, 0)
              else:
                  pimg1 = ImageChops.offset(pimg1, 1, 0)
      except KeyboardInterrupt:
          return None, None
  
      diff = diff.filter(ImageFilter.MaxFilter(5))
  
      diff1 = diff.crop((0, 0, w1, h1))
      diff2 = diff.crop((0, 0, w2, h2))
  
      mask1 = tweak_diff(diff1, opts.opacity)
      mask2 = tweak_diff(diff2, opts.opacity)
  
      return mask1, mask2