code: def _setup_images(directory, brightness, saturation, hue, preserve_transparency):
          
          for file_name in os.listdir(directory):
              with open(os.path.join(directory, file_name), "rb") as fi:
                  image = Image.open(fi).convert("RGBA")
              # Only perform required operations
              if brightness != 1.0:
                  enhancer = ImageEnhance.Brightness(image)
                  image = enhancer.enhance(brightness)
              if saturation != 1.0:
                  enhancer = ImageEnhance.Color(image)
                  image = enhancer.enhance(saturation)
              if hue != 1.0:
                  image = imgops.shift_hue(image, hue)
              if preserve_transparency is True:
                  image = imgops.make_transparent(image)
              # Save the new image
              image.save(os.path.join(directory, file_name.replace("gif", "png")))
              image.close()
          for file_name in (item for item in os.listdir(directory) if item.endswith(".gif")):
              os.remove(os.path.join(directory, file_name))
docs: Apply modifiers to the images of a theme
  
          Modifies the images using the PIL.ImageEnhance module. Using
          this function, theme images are modified to given them a
          unique look and feel. Works best with PNG-based images.