File size: 1,120 Bytes
e5b8fac |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
from ...components import sizes
from ...components.fields import Field
from ...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], )
|