      @staticmethod
      def get_preview_samples(imagefiles, num_images, thumbnail_size):
          """ Return a subset of the imagefiles images
              Exclude final file so we don't accidentally load a file that is being saved """
          logger.trace("num_images: %s", num_images)
          samples = list()
          start_idx = len(imagefiles) - (num_images + 1)
          end_idx = len(imagefiles) - 1
          logger.trace("start_idx: %s, end_idx: %s", start_idx, end_idx)
          show_files = sorted(imagefiles, key=os.path.getctime)[start_idx: end_idx]
 
</s> remove         logger.trace("start_idx: %s, end_idx: %s", start_idx, end_idx)
 </s> add         logger.debug("start_idx: %s, end_idx: %s", start_idx, end_idx) </s> remove         filenames, samples = self.get_preview_samples(imagefiles, num_images, thumbnail_size)
        show_image = self.place_previews(samples, frame_dims)
        logger.trace("Displaying preview: '%s'", filenames)
 </s> add         self.load_images_to_cache(imagefiles, frame_dims, thumbnail_size)
        if imagefiles == [gui_preview]:
            # Delete the preview image so that the main scripts know to output another
            logger.debug("Deleting preview image")
            os.remove(imagefiles[0])
        show_image = self.place_previews(frame_dims)
        logger.debug("Displaying preview: '%s'", self.previewcache["filenames"]) </s> remove         logger.trace("num_images: %s, thumbnail_size: %s", num_images, thumbnail_size)
 </s> add         if self.previewcache["placeholder"] is None:
            self.create_placeholder(thumbnail_size)

        logger.debug("num_images: %s, thumbnail_size: %s", num_images, thumbnail_size) </s> remove         logger.trace("cols: %s, rows: %s", cols, rows)
 </s> add         logger.debug("cols: %s, rows: %s", cols, rows)
        remainder = (cols * rows) % num_images
        if remainder != 0:
            logger.debug("Padding final row. Remainder: %s", remainder)
            placeholder = np.concatenate([np.expand_dims(self.previewcache["placeholder"],
                                                         0)] * remainder)
            samples = np.concatenate((samples, placeholder))
        logger.debug("num_images: %s", num_images)
      @staticmethod
      def get_preview_samples(imagefiles, num_images, thumbnail_size):
          """ Return a subset of the imagefiles images
              Exclude final file so we don't accidentally load a file that is being saved """
        logger.debug("num_images: %s", num_images)
          samples = list()
          start_idx = len(imagefiles) - (num_images + 1)
          end_idx = len(imagefiles) - 1
          logger.trace("start_idx: %s, end_idx: %s", start_idx, end_idx)
          show_files = sorted(imagefiles, key=os.path.getctime)[start_idx: end_idx]
keep keep keep keep replace keep keep keep keep keep
 GUI: Preview for convert

Display preview when outputting to a stream container (e.g. video, gif) 
lib/gui/utils.py