code: def rewrite_image(filepath):
      """Replace the image by an new one with smaller size (uniform color).
  
      Args:
        filepath: path of the images to get processed
      """
      image_content = PIL.Image.open(filepath)
      image = np.array(image_content)
      # Filter unsuported images
      if image_content.mode == "RGBA" or image.dtype == bool:
          return
  
      # The color is a deterministic function of the relative filepath.
      assert filepath.startswith(FLAGS.fake_dir)
      relative_filepath = filepath[len(FLAGS.fake_dir) :]
      color = int(
          hashlib.md5(relative_filepath.encode("utf-8")).hexdigest(), 16
      )
      color %= 255
  
      image = np.ones_like(image) * color
      image = PIL.Image.fromarray(image)
      image.save(filepath, optimize=True)
  
file_path: datasets/tensorflow_datasets/scripts/replace_fake_images.py
imports: import hashlib
  import os
  import tarfile
  import tempfile
  import zipfile
  import zlib
  import absl.app
  import absl.flags
  import numpy
  import PIL.Image
label_desc: Use image node_id 1 for calling a global function with example usage: rewrite_image(filepath) without return types