RSGISLib Image Tools

Animate Images List[str], output_img: str, fps: int = 1, resize: bool = False, out_x_size: int = 720, out_y_size: Optional[int] = None, tmp_dir: str = './tmp')

A function which uses the imageio module to animate a set input images to create an animated GIF video file. This is intended to be used to a set of images which have been exported (e.g., from the mapping module).

The input images can be resampled to a new size but this requires the PIL module to be installed.

  • input_imgs – list of input image paths

  • output_img – output image file path.

  • fps – the number of frames per second. Higher values will result in faster video (i.e., less time per frame). Default: 1.

  • resize – boolean specifying whether to resize the input images.

  • out_x_size – the size of the output image (if resizing) for the x axis. Default: 720

  • out_y_size – the size of the output image (if resizing) for the y axis. If None then the size is calculated from the input image to keep the proportions the same. Default: None

  • tmp_dir – a temp path for the resized images to be written to if resizing the input images.

EXIF Metadata

A function which lists the exif information from an input image using the PIL module.


input_img – the path to the input image

Sort Images, output_base_dir, time_split_secs=60, date_time_tag='DateTime', date_time_format='%Y:%m:%d %H:%M:%S', out_date_time_format='%Y%m%d_%H%M%S')

A function which splits a set of images (e.g., from drone surveys) by time. Where photos taken within the specified time window will be clustered together (default: 60 seconds). The photos are then copied into a new directory based on the start time of the cluster. Note, photos are copied and not moved from their current location.

  • input_imgs – a list of input images (e.g., glob.glob(”*.jpg”))

  • output_base_dir – the output base directory where the output directories will be created.

  • time_split_secs – The time difference in seconds for a new cluster to be created.

  • date_time_tag – the EXIF tag for the date / time of the acquisition. Default is ‘DataTime’ but this might be different for different cameras and therefore you might need to use the list_exif_info function to find the correct field.

  • date_time_format – The python datetime.strptime format string for the datetime provided in the EXIF metadata. Default: %Y:%m:%d %H:%M:%S

  • out_date_time_format – The python datetime.strftime format string for the used to create the output directory for the files. Note, this must be unique. Default: %Y%m%d_%H%M%S