Download Derfuu_ComfyUI_ModdedNodes/pyscripts/components/sizes.py from Blankse/SegsmakerComfyNodes: direct link, hf CLI and curl.
- Browser
- Download file 796 Bytes
-
https://huggingface.co/datasets/Blankse/SegsmakerComfyNodes/resolve/main/Derfuu_ComfyUI_ModdedNodes/pyscripts/components/sizes.py
- Command line
-
hf download hf://datasets/Blankse/SegsmakerComfyNodes/Derfuu_ComfyUI_ModdedNodes/pyscripts/components/sizes.py
-
curl -L -o sizes.py https://huggingface.co/datasets/Blankse/SegsmakerComfyNodes/resolve/main/Derfuu_ComfyUI_ModdedNodes/pyscripts/components/sizes.py
796 Bytes
| scale_methods = ["nearest-exact", "bilinear", "bicubic", "bislerp", "area", "lanczos"] | |
| 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[int, int], dict[int, int]]: | |
| 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}) | |