code: def reveal(
      input_image: Union[str, IO[bytes]],
      generator: Iterator[int],
      shift: int = 0,
      encoding: str = "UTF-8",
  ):
      
      img = tools.open_image(input_image)
      img_list = list(img.getdata())
      width, height = img.size
      buff, count = 0, 0
      bitab = []
      limit = None
  
      while shift != 0:
          next(generator)
          shift -= 1
  
      while True:
          generated_number = next(generator)
          # color = [r, g, b]
          for color in img_list[generated_number]:
              buff += (color & 1) << (tools.ENCODINGS[encoding] - 1 - count)
              count += 1
              if count == tools.ENCODINGS[encoding]:
                  bitab.append(chr(buff))
                  buff, count = 0, 0
                  if bitab[-1] == ":" and limit == None:
                      if "".join(bitab[:-1]).isdigit():
                          limit = int("".join(bitab[:-1]))
                      else:
                          raise IndexError("Impossible to detect message.")
          if len(bitab) - len(str(limit)) - 1 == limit:
              return "".join(bitab)[len(str(limit)) + 1 :]
docs: Find a message in an image (with the LSB technique).