parent
07225874e8
commit
7dc2784bbb
|
|
@ -3,10 +3,10 @@ import numpy as np
|
|||
from scipy.signal import savgol_filter
|
||||
from typing import Callable
|
||||
import cv2
|
||||
from PIL import Image, ImageFilter, ImageDraw, ImageColor
|
||||
from PIL import Image, ImageDraw, ImageColor
|
||||
from modules.ui import plaintext_to_html
|
||||
import modules.shared as shared
|
||||
from modules.processing import Processed, StableDiffusionProcessing
|
||||
#from modules.processing import Processed, StableDiffusionProcessing
|
||||
from modules.paths_internal import script_path
|
||||
from .helpers import (
|
||||
fix_env_Path_ffprobe,
|
||||
|
|
@ -237,7 +237,7 @@ class InfZoomer:
|
|||
current_image,
|
||||
self.mask_width, self.mask_height,
|
||||
overmask=self.C.overmask,
|
||||
radius=min(self.mask_height,self.mask_height)*0.2
|
||||
radius=min(self.mask_width,self.mask_height)*0.2
|
||||
)
|
||||
|
||||
new_width= masked_image.width
|
||||
|
|
@ -374,7 +374,7 @@ class InfZoomer:
|
|||
current_image.copy(),
|
||||
self.mask_width, self.mask_height,
|
||||
overmask=self.C.overmask,
|
||||
radius=min(self.mask_height,self.mask_height)*0.875
|
||||
radius=min(self.mask_width,self.mask_height)*0.875
|
||||
)
|
||||
|
||||
current_image = shrink_and_paste_on_blank(
|
||||
|
|
@ -608,7 +608,7 @@ class InfZoomer:
|
|||
self.C.blend_image,
|
||||
self.C.blend_mode,
|
||||
self.C.blend_gradient_size,
|
||||
hex_to_rgba(self.C.blend_color))
|
||||
hex_to_rgba(self.C.blend_color))
|
||||
|
||||
for i in range(len(self.main_frames) - 1):
|
||||
# interpolation steps between 2 inpainted images (=sequential zoom and crop)
|
||||
|
|
@ -746,12 +746,12 @@ class InfZoomer:
|
|||
mask_width = self.mask_width
|
||||
mask_height = self.mask_height
|
||||
# set minimum mask size to 12.5% of the image size
|
||||
if mask_width < self.width // 8:
|
||||
if mask_width < closest_upper_divisible_by_eight(self.width // 8):
|
||||
mask_width = closest_upper_divisible_by_eight(self.width // 8)
|
||||
mask_height = closest_upper_divisible_by_eight(self.height // 8)
|
||||
print(f"\033[93m{self.mask_width}x{self.mask_height} set - used: {mask_width}x{mask_height} Recommend: {self.width // 4}x{self.height // 4} Correct in Outpaint pixels settings.")
|
||||
# set maximum mask size to 75% of the image size
|
||||
if mask_width > (self.width // 4) * 3:
|
||||
if mask_width > closest_upper_divisible_by_eight((self.width // 4) * 3):
|
||||
mask_width = closest_upper_divisible_by_eight((self.width // 4) * 3)
|
||||
mask_height = closest_upper_divisible_by_eight((self.height // 4) * 3)
|
||||
print(f"\033[93m{self.mask_width}x{self.mask_height} set - used: {mask_width}x{mask_height} Recommend: {self.width // 4}x{self.height // 4} Correct in Outpaint pixels settings.")
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ default_mask_blur = 48
|
|||
default_gradient_size = 61
|
||||
default_overmask = 8
|
||||
default_total_outpaints = 5
|
||||
default_outpaint_amount = 128
|
||||
promptTableHeaders = ["Outpaint Steps", "Prompt", "image location", "blend mask", "is keyframe"], ["number", "str", "str", "str", "bool"]
|
||||
|
||||
default_prompt = """
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ from .static_variables import (
|
|||
default_sampler,
|
||||
default_overmask,
|
||||
default_gradient_size,
|
||||
default_outpaint_amount,
|
||||
)
|
||||
from .helpers import validatePromptJson_throws, putPrompts, clearPrompts, renumberDataframe
|
||||
from .prompt_util import readJsonPrompt
|
||||
|
|
@ -112,7 +113,7 @@ def on_ui_tabs():
|
|||
value=shared.opts.data.get("infzoom_outsizeW", 512),
|
||||
step=8,
|
||||
label="Output Width",
|
||||
)
|
||||
)
|
||||
main_height = gr.Slider(
|
||||
minimum=16,
|
||||
maximum=2048,
|
||||
|
|
@ -244,11 +245,13 @@ Ideas for custom blend images: https://www.pexels.com/search/gradient/
|
|||
with gr.Tab("Outpaint"):
|
||||
outpaint_amount_px = gr.Slider(
|
||||
label="Outpaint pixels",
|
||||
minimum=4,
|
||||
maximum=508,
|
||||
minimum=8,
|
||||
maximum=512,
|
||||
step=8,
|
||||
value=188,
|
||||
value=default_outpaint_amount,
|
||||
elem_id="infzoom_outpaintAmount"
|
||||
)
|
||||
main_width.change(get_min_outpaint_amount,inputs=[main_width, outpaint_amount_px],outputs=[outpaint_amount_px])
|
||||
|
||||
inpainting_mask_blur = gr.Slider(
|
||||
label="Mask Blur",
|
||||
|
|
@ -263,6 +266,7 @@ Ideas for custom blend images: https://www.pexels.com/search/gradient/
|
|||
maximum=64,
|
||||
step=1,
|
||||
value=default_overmask,
|
||||
elem_id="infzoom_outpaintOvermask"
|
||||
)
|
||||
inpainting_fill_mode = gr.Radio(
|
||||
label="Masked content",
|
||||
|
|
@ -442,4 +446,8 @@ def checkPrompts(p):
|
|||
)
|
||||
|
||||
def get_filename(file):
|
||||
return file.name
|
||||
return file.name
|
||||
|
||||
def get_min_outpaint_amount(width, outpaint_amount):
|
||||
min_outpaint_px = max(outpaint_amount, width // 4)
|
||||
return min_outpaint_px
|
||||
Loading…
Reference in New Issue