                   for f in os.listdir(image_path) if f.lower().endswith((".png", ".jpg"))]
          logger.debug("Image files: %s", files)
          return files
  
      def load_latest_preview(self, thumbnail_size, frame_dims):
          """ Load the latest preview image for extract and convert.
  
          Retrieves the latest preview images from the faceswap output folder, resizes to thumbnails
          and lays out for display. Places the images into :attr:`previewoutput` for loading into
          the display panel.
 
</s> remove             return None
 </s> add             return [] </s> remove     def _load_images_to_cache(self, image_files, frame_dims, thumbnail_size):
 </s> add     def _load_images_to_cache(self,
                              image_files: List[str],
                              frame_dims: Tuple[int, int],
                              thumbnail_size: int) -> bool: </s> remove     def _place_previews(self, frame_dims):
 </s> add     def _place_previews(self, frame_dims: Tuple[int, int]) -> Image.Image: </s> remove         logger.debug("Cache shape: %s", self._previewcache["images"].shape)
 </s> add         logger.debug("Cache shape: %s", cast(np.ndarray, self._previewcache["images"]).shape) </s> remove             if img.size[0] != img.size[1]:
                # Pad to square
                new_img = Image.new("RGB", (thumbnail_size, thumbnail_size))
                new_img.paste(img, ((thumbnail_size - img.size[0])//2,
                                    (thumbnail_size - img.size[1])//2))
                img = new_img
            draw = ImageDraw.Draw(img)
            draw.rectangle(((0, 0), (thumbnail_size, thumbnail_size)), outline="#E5E5E5", width=1)
            samples.append(np.array(img))

        samples = np.array(samples)
        if not np.any(samples):
 </s> add             samples.append(self._pad_and_border(img, thumbnail_size))

        return self._process_samples(samples,
                                     [fname for fname in show_files if fname not in dropped_files],
                                     num_images)

    def _pad_and_border(self, image: Image.Image, size: int) -> np.ndarray:
        """ Pad rectangle images to a square and draw borders

        Parameters
        ----------
        image: :class:`PIL.Image`
            The image to process
        size: int
            The size of the image as it should be displayed

        Returns
        -------
        :class:`PIL.Image`:
            The processed image
        """
        if image.size[0] != image.size[1]:
            # Pad to square
            new_img = Image.new("RGB", (size, size))
            new_img.paste(image, ((size - image.size[0]) // 2, (size - image.size[1]) // 2))
            image = new_img
        draw = ImageDraw.Draw(image)
        draw.rectangle(((0, 0), (size, size)), outline="#E5E5E5", width=1)
        retval = np.array(image)
        logger.trace("image shape: %s", retval.shape)  # type: ignore
        return retval

    def _process_samples(self,
                         samples: List[np.ndarray],
                         filenames: List[str],
                         num_images: int) -> bool:
        """ Process the latest sample images into a displayable image.

        Parameters
        ----------
        samples: list
            The list of extract/convert preview images to display
        filenames: list
            The full path to the filenames corresponding to the images
        num_images: int
            The number of images that should be displayed

        Returns
        -------
        bool
            ``True`` if samples succesfully compiled otherwise ``False``
        """
        asamples = np.array(samples)
        if not np.any(asamples):
    def load_latest_preview(self, thumbnail_size: int, frame_dims: Tuple[int, int]) -> None:
                   for f in os.listdir(image_path) if f.lower().endswith((".png", ".jpg"))]
          logger.debug("Image files: %s", files)
          return files
  
    def load_latest_preview(self, thumbnail_size: int, frame_dims: Tuple[int, int]) -> None:
          """ Load the latest preview image for extract and convert.
  
          Retrieves the latest preview images from the faceswap output folder, resizes to thumbnails
          and lays out for display. Places the images into :attr:`previewoutput` for loading into
          the display panel.
keep keep keep keep replace keep keep keep keep keep
 Bugfix: Preview for extract in batch mode 
lib/gui/utils.py