From 3d6c28d5dcc64e359411e837cb4a6224dacca2a5 Mon Sep 17 00:00:00 2001 From: bash-j Date: Mon, 21 Aug 2023 07:58:14 +0930 Subject: [PATCH] modified: mikey_nodes.py --- mikey_nodes.py | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/mikey_nodes.py b/mikey_nodes.py index f059534..8b2c293 100644 --- a/mikey_nodes.py +++ b/mikey_nodes.py @@ -504,15 +504,17 @@ class RatioAdvanced: crop_w = self.ratio_config[preset]['crop_w'] crop_h = self.ratio_config[preset]['crop_h'] if preset_rotate == 'landscape': - latent_width, latent_height = latent_height, latent_width - cte_w, cte_h = cte_h, cte_w - target_w, target_h = target_h, target_w - crop_w, crop_h = crop_h, crop_w + if latent_height > latent_width: + latent_width, latent_height = latent_height, latent_width + cte_w, cte_h = cte_h, cte_w + target_w, target_h = target_h, target_w + crop_w, crop_h = crop_h, crop_w elif preset_rotate == 'portrait': - latent_width, latent_height = latent_height, latent_width - cte_w, cte_h = cte_h, cte_w - target_w, target_h = target_h, target_w - crop_w, crop_h = crop_h, crop_w + if latent_width > latent_height: + latent_width, latent_height = latent_height, latent_width + cte_w, cte_h = cte_h, cte_w + target_w, target_h = target_h, target_w + crop_w, crop_h = crop_h, crop_w """ example user_ratio_presets.json { @@ -615,15 +617,17 @@ class PresetRatioSelector: crop_w = self.ratio_config[select_preset]['crop_w'] crop_h = self.ratio_config[select_preset]['crop_h'] if preset_rotate == 'landscape': - latent_width, latent_height = latent_height, latent_width - cte_w, cte_h = cte_h, cte_w - target_w, target_h = target_h, target_w - crop_w, crop_h = crop_h, crop_w + if latent_height > latent_width: + latent_width, latent_height = latent_height, latent_width + cte_w, cte_h = cte_h, cte_w + target_w, target_h = target_h, target_w + crop_w, crop_h = crop_h, crop_w elif preset_rotate == 'portrait': - latent_width, latent_height = latent_height, latent_width - cte_w, cte_h = cte_h, cte_w - target_w, target_h = target_h, target_w - crop_w, crop_h = crop_h, crop_w + if latent_width > latent_height: + latent_width, latent_height = latent_height, latent_width + cte_w, cte_h = cte_h, cte_w + target_w, target_h = target_h, target_w + crop_w, crop_h = crop_h, crop_w return (latent_width, latent_height, cte_w, cte_h, target_w, target_h,