Python Script to Process Images

Would anyone know how to modify python code so it loads all images first then processes? Right now it loads one image and processes, which increases the render time.

  import gigapixel
  from gigapixel import Gigapixel, Scale, Mode, OutputFormat
  from pathlib import Path
  import os
  def process_an_image(each):
      # Path to Gigapixel executable file.
      exe_path = Path('C:\Program Files\Topaz Labs LLC\Topaz Gigapixel AI\Topaz Gigapixel AI.exe')
      output_suffix = '-gigapixel'
      # Create Gigapixel instance.
      app = Gigapixel(exe_path, output_suffix)
      # Process image.
      image = Path(each)
      output_path = app.process(image)
      # Print output path.
  # Set the directory
  image_dir = "N:/"
  png_files = [file for file in os.listdir(image_dir) if file.endswith('.png')]
  for each in png_files:
      each = image_dir + each

We currently don’t support this, but you may find someone that knows how to do it if possible.