From d4141577012665322b61dd90f20a1a7e8d8e0581 Mon Sep 17 00:00:00 2001 From: missionfloyd Date: Sun, 9 Apr 2023 19:19:14 -0600 Subject: [PATCH] Fix transpose with non-square images --- comfy_extras/nodes_post_processing.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/comfy_extras/nodes_post_processing.py b/comfy_extras/nodes_post_processing.py index 9a8cdc846..ceb0b92e1 100644 --- a/comfy_extras/nodes_post_processing.py +++ b/comfy_extras/nodes_post_processing.py @@ -232,6 +232,8 @@ class Transpose: def transpose(self, image: torch.Tensor, method: str): batch_size, height, width, _ = image.shape result = torch.zeros_like(image) + if height != width and method in ("Transpose", "Transverse", "Rotate 90°", "Rotate 270°"): + result = torch.permute(result, (0, 2, 1, 3)) methods = { "Flip horizontal": Image.Transpose.FLIP_LEFT_RIGHT,