PreviewExtract
- class lib.gui.utils.image.PreviewExtract(cache_path: str)
Bases:
objectHandles the loading of preview images for extract and convert
- Parameters:
cache_path (str) – Full path to the cache folder that contains the preview images
Attributes Summary
PIL.ImageTk.PhotoImageThe preview image for displaying in a tkinter canvasMethods Summary
Remove any image preview files
load_latest_preview(thumbnail_size, frame_dims)Load the latest preview image for extract and convert.
save(filename)Save the currently displaying preview image to the given location
set_faceswap_output_path(location[, batch_mode])Set the path that will contain the output from an Extract or Convert task.
Attributes Documentation
- image
PIL.ImageTk.PhotoImageThe preview image for displaying in a tkinter canvas
Methods Documentation
- delete_previews() None
Remove any image preview files
- Return type:
None
- load_latest_preview(thumbnail_size: int, frame_dims: tuple[int, int]) bool
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
preview_imagefor loading into the display panel.- Parameters:
thumbnail_size (int) – The size of each thumbnail that should be created
frame_dims (tuple) – The (width (int), height (int)) of the display panel that will display the preview
- Returns:
Trueif a preview was successfully loaded otherwiseFalse- Return type:
bool
- save(filename: str) None
Save the currently displaying preview image to the given location
- Parameters:
filename (str) – The full path to the filename to save the preview image to
- Return type:
None
- set_faceswap_output_path(location: str, batch_mode: bool = False) None
Set the path that will contain the output from an Extract or Convert task.
Required so that the GUI can fetch output images to display for return in
preview_image.- Parameters:
location (str) – The output location that has been specified for an Extract or Convert task
batch_mode (bool) –
Trueif extracting in batch mode otherwise False
- Return type:
None
- delete_previews() None
Remove any image preview files
- Return type:
None
- property image: PhotoImage
PIL.ImageTk.PhotoImageThe preview image for displaying in a tkinter canvas
- load_latest_preview(thumbnail_size: int, frame_dims: tuple[int, int]) bool
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
preview_imagefor loading into the display panel.- Parameters:
thumbnail_size (int) – The size of each thumbnail that should be created
frame_dims (tuple) – The (width (int), height (int)) of the display panel that will display the preview
- Returns:
Trueif a preview was successfully loaded otherwiseFalse- Return type:
bool
- save(filename: str) None
Save the currently displaying preview image to the given location
- Parameters:
filename (str) – The full path to the filename to save the preview image to
- Return type:
None
- set_faceswap_output_path(location: str, batch_mode: bool = False) None
Set the path that will contain the output from an Extract or Convert task.
Required so that the GUI can fetch output images to display for return in
preview_image.- Parameters:
location (str) – The output location that has been specified for an Extract or Convert task
batch_mode (bool) –
Trueif extracting in batch mode otherwise False
- Return type:
None