mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-07 21:00:49 +08:00
ResizeByLongerSide: support video
(cherry picked from commit 98c6840aa4e5fd5407ba9ab113d209011e474bf6)
This commit is contained in:
parent
8fd07170f1
commit
f48e70c29e
@ -667,16 +667,19 @@ class ResizeImagesByLongerEdgeNode(ImageProcessingNode):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _process(cls, image, longer_edge):
|
def _process(cls, image, longer_edge):
|
||||||
img = tensor_to_pil(image)
|
resized_images = []
|
||||||
w, h = img.size
|
for image_i in image:
|
||||||
if w > h:
|
img = tensor_to_pil(image_i)
|
||||||
new_w = longer_edge
|
w, h = img.size
|
||||||
new_h = int(h * (longer_edge / w))
|
if w > h:
|
||||||
else:
|
new_w = longer_edge
|
||||||
new_h = longer_edge
|
new_h = int(h * (longer_edge / w))
|
||||||
new_w = int(w * (longer_edge / h))
|
else:
|
||||||
img = img.resize((new_w, new_h), Image.Resampling.LANCZOS)
|
new_h = longer_edge
|
||||||
return pil_to_tensor(img)
|
new_w = int(w * (longer_edge / h))
|
||||||
|
img = img.resize((new_w, new_h), Image.Resampling.LANCZOS)
|
||||||
|
resized_images.append(pil_to_tensor(img))
|
||||||
|
return torch.cat(resized_images, dim=0)
|
||||||
|
|
||||||
|
|
||||||
class CenterCropImagesNode(ImageProcessingNode):
|
class CenterCropImagesNode(ImageProcessingNode):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user