Files
Derfuu-Derfuu_ComfyUI_Modde…/pyscripts/Nodes/Functions/GetSizes.py
T
Derfuu 665c3f10b1 Debug node get additional output to be able for use in-line with other nodes;
Removed(commented) "Tuples" nodes;
Removed "TUPLES" type from "Get size" nodes; (DON'T FORGET TO REPLACE THEM IF THEY'RE PERSISTS IN YOUR WORKFLOW)
Types moved into their own class with class methods and default parameters instead of just tuples with strings and dicts;
Added "Logic node" (>, <, =, AND, OR, XOR); (idk why i did this one, but got an idea that with object recognition models to count objects and correct them in next iterations would be not so bad idea as i think. Or something like this)
changed README.md to current state of this repo
2024-04-03 03:07:33 +03:00

51 lines
1.2 KiB
Python

from custom_nodes.Derfuu_ComfyUI_ModdedNodes.pyscripts.components.fields import Field
import custom_nodes.Derfuu_ComfyUI_ModdedNodes.pyscripts.components.sizes as sizes
from custom_nodes.Derfuu_ComfyUI_ModdedNodes.pyscripts.components.tree import TREE_FUNCTIONS
class GetLatentSize:
def __init__(self) -> None:
pass
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"latent": Field.latent(),
"original": Field.field([False, True]),
}
}
RETURN_TYPES = ("INT", "INT",)
RETURN_NAMES = ("WIDTH", "HEIGHT")
CATEGORY = TREE_FUNCTIONS
FUNCTION = 'get_size'
def get_size(self, latent, original):
size = sizes.get_latent_size(latent, original)
return (size[0], size[1],)
class GetImageSize:
def __init__(self) -> None:
pass
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"image": Field.image(),
}
}
RETURN_TYPES = ("INT", "INT",)
RETURN_NAMES = ("WIDTH", "HEIGHT")
CATEGORY = TREE_FUNCTIONS
FUNCTION = 'get_size'
def get_size(self, image):
size = sizes.get_image_size(image)
return (size[0], size[1], )