From 7ef489adc91efd8f7f3580ea0b1e03d421f967df Mon Sep 17 00:00:00 2001 From: GeorgLegato Date: Sat, 15 Apr 2023 20:38:04 +0200 Subject: [PATCH 1/2] fix width for square --- scripts/inifnite-zoom.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/inifnite-zoom.py b/scripts/inifnite-zoom.py index 9353ec0..c6d62f8 100644 --- a/scripts/inifnite-zoom.py +++ b/scripts/inifnite-zoom.py @@ -7,6 +7,7 @@ sys.path.extend(basedir + "/extensions/infinite-zoom-automatic1111-webui/") import numpy as np import gradio as gr from PIL import Image +import math from iz_helpers import shrink_and_paste_on_blank, write_video from webui import wrap_gradio_gpu_call @@ -140,7 +141,8 @@ def create_zoom( height, ) current_image = processed.images[0] - mask_width = 128 + + mask_width = math.trunc(width/4) # was initially 512px => 128px num_interpol_frames = round(video_frame_rate * zoom_speed) all_frames = [] From 846e7b05349a8924f4084ae078d6b303a0d0b2d9 Mon Sep 17 00:00:00 2001 From: GeorgLegato Date: Sun, 16 Apr 2023 00:09:18 +0200 Subject: [PATCH 2/2] disable block size, maybe unforcing videos always 512px --- iz_helpers/video.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iz_helpers/video.py b/iz_helpers/video.py index afffe1a..63aad92 100644 --- a/iz_helpers/video.py +++ b/iz_helpers/video.py @@ -14,10 +14,10 @@ def write_video(file_path, frames, fps, reversed=True, start_frame_dupe_amount=1 frames = frames[::-1] # Get dimensions of the frames - w, h = frames[0].size + # w, h = frames[0].size - # Create an imageio video writer - writer = imageio.get_writer(file_path, fps=fps) + # Create an imageio video writer, avoid block size of 512. + writer = imageio.get_writer(file_path, fps=fps, macro_block_size=None) # Duplicate the start and end frames start_frames = [frames[0]] * start_frame_dupe_amount