image check and save

This commit is contained in:
Vladimir Mandic
2023-12-19 08:26:13 -05:00
parent ff94b197c1
commit 2986f5532e
3 changed files with 9 additions and 5 deletions
+6 -2
View File
@@ -678,7 +678,7 @@ def save_video_atomic(images, filename, video_type: str = 'none', duration: floa
shared.log.info(f'Save video: file="{filename}" frames={len(append) + 1} duration={duration} loop={loop} size={size}')
def save_video(p, images, filename = None, video_type: str = 'none', duration: float = 2.0, loop: bool = False, interpolate: int = 0, scale: float = 1.0, pad: int = 1, change: float = 0.3):
def save_video(p, images, filename = None, video_type: str = 'none', duration: float = 2.0, loop: bool = False, interpolate: int = 0, scale: float = 1.0, pad: int = 1, change: float = 0.3, sync: bool = False):
if images is None or len(images) < 2 or video_type is None or video_type.lower() == 'none':
return
image = images[0]
@@ -696,7 +696,11 @@ def save_video(p, images, filename = None, video_type: str = 'none', duration: f
if not filename.lower().endswith(video_type.lower()):
filename += f'.{video_type.lower()}'
filename = namegen.sanitize(filename)
threading.Thread(target=save_video_atomic, args=(images, filename, video_type, duration, loop, interpolate, scale, pad, change)).start()
if not sync:
threading.Thread(target=save_video_atomic, args=(images, filename, video_type, duration, loop, interpolate, scale, pad, change)).start()
else:
save_video_atomic(images, filename, video_type, duration, loop, interpolate, scale, pad, change)
return filename
def safe_decode_string(s: bytes):
+2 -2
View File
@@ -379,8 +379,8 @@ class Processed:
self.subseed_strength = p.subseed_strength
self.info = info
self.comments = comments
self.width = p.width if hasattr(p, 'width') else self.images[0].width
self.height = p.height if hasattr(p, 'height') else self.images[0].height
self.width = p.width if hasattr(p, 'width') else (self.images[0].width if len(self.images) > 0 else 0)
self.height = p.height if hasattr(p, 'height') else (self.images[0].height if len(self.images) > 0 else 0)
self.sampler_name = p.sampler_name
self.cfg_scale = p.cfg_scale
self.image_cfg_scale = p.image_cfg_scale