51 lines
1.1 KiB
Python
51 lines
1.1 KiB
Python
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], )
|