Skip to content

Commit

Permalink
Merge pull request #18 from daniabib/image-to-scale-shortest
Browse files Browse the repository at this point in the history
Add "Shortest" option to Image scale to side
  • Loading branch information
Derfuu committed Mar 28, 2024
2 parents 2ace4c4 + 20c5cbe commit d89bc48
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Nodes/Modded/StandardInputs/Images.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def INPUT_TYPES(cls):
"required": {
"image": ("IMAGE",),
"side_length": field.INT,
"side": (["Longest", "Width", "Height"],),
"side": (["Longest", "Shortest", "Width", "Height"],),
"upscale_method": (cls.upscale_methods,),
"crop": (cls.crop_methods,)}}

Expand Down Expand Up @@ -90,6 +90,13 @@ def determineSide(_side: str) -> tuple[int, int]:
width, height = determineSide("Width")
else:
width, height = determineSide("Height")

if side == "Shortest":
if width < height:
width, height = determineSide("Width")
else:
width, height = determineSide("Height")

else:
width, height = determineSide(side)

Expand All @@ -98,4 +105,4 @@ def determineSide(_side: str) -> tuple[int, int]:

cls = comfy.utils.common_upscale(samples, width, height, upscale_method, crop)
cls = cls.movedim(1, -1)
return (cls,)
return (cls,)

0 comments on commit d89bc48

Please sign in to comment.