Added ImageProperties and LatentProperties

This commit is contained in:
NattoMaki
2023-11-28 17:55:21 +09:00
parent 17f67bb3f0
commit 0248119829
2 changed files with 50 additions and 0 deletions
+5
View File
@@ -2,12 +2,15 @@ from .negi.openai_dalle3 import OpenAiDalle3
from .negi.openai_translate import OpenAiTranslate
from .negi.string_function import StringFunction
from .negi.seed_generator import SeedGenerator
from .negi.image_properties import ImageProperties, LatentProperties
NODE_CLASS_MAPPINGS = {
"NegiTools_OpenAiDalle3": OpenAiDalle3,
"NegiTools_OpenAiTranslate": OpenAiTranslate,
"NegiTools_StringFunction": StringFunction,
"NegiTools_SeedGenerator": SeedGenerator,
"NegiTools_ImageProperties": ImageProperties,
"NegiTools_LatentProperties": LatentProperties,
}
NODE_DISPLAY_NAME_MAPPINGS = {
@@ -15,4 +18,6 @@ NODE_DISPLAY_NAME_MAPPINGS = {
"NegiTools_OpenAiTranslate": "OpenAI Translate to English 🧅",
"NegiTools_StringFunction": "String Function 🧅",
"NegiTools_SeedGenerator": "Seed Generator 🧅",
"NegiTools_ImageProperties": "Image Properties 🧅",
"NegiTools_LatentProperties": "Latent Properties 🧅",
}
+45
View File
@@ -0,0 +1,45 @@
class ImageProperties:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"image": ("IMAGE",)
},
}
RETURN_TYPES = ("INT", "INT",)
RETURN_NAMES = ("WIDTH", "HEIGHT",)
FUNCTION = "doit"
OUTPUT_NODE = False
CATEGORY = "utils"
def doit(self, image):
# print("shape = " + str(list(image.shape)))
return (image.shape[2], image.shape[1],)
class LatentProperties:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"latent": ("LATENT",)
},
}
RETURN_TYPES = ("INT", "INT",)
RETURN_NAMES = ("WIDTH", "HEIGHT",)
FUNCTION = "doit"
OUTPUT_NODE = False
CATEGORY = "utils"
def doit(self, latent):
image = latent["samples"]
# print("shape = " + str(list(image.shape)))
return (image.shape[3] * 8, image.shape[2] * 8,)