              logger.debug("No new images in output folder")
          else:
              self._previewcache["modified"] = max(os.path.getmtime(img) for img in retval)
              logger.debug("Number new images: %s, Last Modified: %s",
                           len(retval), self._previewcache["modified"])
          return retval
  
      def _load_images_to_cache(self,
                                image_files: List[str],
                                frame_dims: Tuple[int, int],
 
</s> remove         asamples = np.array(samples)
        if not np.any(asamples):
            logger.debug("No preview images collected.")
            return False

        self._previewcache["filenames"] = (cast(List[str], self._previewcache["filenames"]) +
                                           filenames)[-num_images:]
        cache = cast(Optional[np.ndarray], self._previewcache["images"])
        if cache is None:
            logger.debug("Creating new cache")
            cache = asamples[-num_images:]
        else:
            logger.debug("Appending to existing cache")
            cache = np.concatenate((cache, asamples))[-num_images:]
        self._previewcache["images"] = cache
        logger.debug("Cache shape: %s", cast(np.ndarray, self._previewcache["images"]).shape)
        return True
 </s> add         logger.debug("Creating placeholder. thumbnail_size: %s", thumbnail_size)
        placeholder = Image.new("RGB", (thumbnail_size, thumbnail_size))
        draw = ImageDraw.Draw(placeholder)
        draw.rectangle(((0, 0), (thumbnail_size, thumbnail_size)), outline="#E5E5E5", width=1)
        placeholder = np.array(placeholder)
        self._placeholder = placeholder
        logger.debug("Created placeholder. shape: %s", placeholder.shape) </s> remove         assert self._pathoutput is not None
        folders = [] if not os.path.exists(self._pathoutput) else [
            os.path.join(self._pathoutput, folder)
            for folder in os.listdir(self._pathoutput)
            if os.path.isdir(os.path.join(self._pathoutput, folder))]
 </s> add         folders = [] if not os.path.exists(self._output_path) else [
            os.path.join(self._output_path, folder)
            for folder in os.listdir(self._output_path)
            if os.path.isdir(os.path.join(self._output_path, folder))] </s> remove     def resize_image(self, name: str, frame_dims: Optional[Tuple[int, int]]) -> None:
        """ Resize the training preview image based on the passed in frame size.
 </s> add         """
        size = get_config().user_config_dict.get("icon_size", 16)
        size = int(round(size * get_config().scaling_factor))
        icons: Dict[str, ImageTk.PhotoImage] = {}
        pathicons = os.path.join(PATHCACHE, "icons")
        for fname in os.listdir(pathicons):
            name, ext = os.path.splitext(fname)
            if ext != ".png":
                continue
            img = Image.open(os.path.join(pathicons, fname))
            img = ImageTk.PhotoImage(img.resize((size, size), resample=Image.HAMMING))
            icons[name] = img
        logger.debug(icons)
        return icons </s> remove         size = get_config().user_config_dict.get("icon_size", 16)
        size = int(round(size * get_config().scaling_factor))
        icons: Dict[str, ImageTk.PhotoImage] = {}
        pathicons = os.path.join(PATHCACHE, "icons")
        for fname in os.listdir(pathicons):
            name, ext = os.path.splitext(fname)
            if ext != ".png":
                continue
            img = Image.open(os.path.join(pathicons, fname))
            img = ImageTk.PhotoImage(img.resize((size, size), resample=Image.HAMMING))
            icons[name] = img
        logger.debug(icons)
        return icons
 </s> add         logger.debug("Saving preview to %s", filename)
        assert self._preview_image is not None
        self._preview_image.save(filename) </s> remove                  screen_dimensions: Tuple[int, int]) -> None:
 </s> add                  screen_dimensions: Tuple[int, int],
                 is_standalone: bool) -> None:
                         len(retval), self._modified)
              logger.debug("No new images in output folder")
          else:
              self._previewcache["modified"] = max(os.path.getmtime(img) for img in retval)
              logger.debug("Number new images: %s, Last Modified: %s",
                         len(retval), self._modified)
          return retval
  
      def _load_images_to_cache(self,
                                image_files: List[str],
                                frame_dims: Tuple[int, int],
keep keep keep keep replace keep keep keep keep keep
 GUI - Preview updates
  - Training preview. Embed preview pop-out window
  - Bugfix - convert/extract previews 
lib/gui/utils/image.py