Files
Derfuu-Derfuu_ComfyUI_Modde…/pyscripts/components/sizes.py
T
Derfuu 7b6746767c preparing for adding custom js nodes...
- moved all python scripts into /pyscripts/ folder
- added all /pyscripts/**__init__.py into gitignore
2024-03-29 02:04:30 +03:00

23 lines
729 B
Python

def get_latent_size(LATENT, ORIGINAL_VALUES=False) -> tuple[int, int]:
lc = LATENT.copy()
size = lc["samples"].shape[3], lc["samples"].shape[2]
if ORIGINAL_VALUES == False:
size = size[0] * 8, size[1] * 8
return size
def get_image_size(IMAGE) -> tuple[int, int]:
samples = IMAGE.movedim(-1, 1)
size = samples.shape[3], samples.shape[2]
# size = size.movedim(1, -1)
return size
def get_conditioning_size(CONDITIONING) -> tuple[dict["width", "height"], dict["x_offset", "y_offset"]]:
size = CONDITIONING["area"]
width = size[1]
height = size[0]
x_offs = size[3]
y_offs = size[2]
return ({"width": width, "height": height},{"x_offset": x_offs, "y_offset":y_offs})