mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2025-12-09 04:44:30 +08:00
update custom presets
This commit is contained in:
parent
3dacf166df
commit
999be76780
@ -1,12 +1,22 @@
|
||||
[
|
||||
"512x512",
|
||||
"768x512",
|
||||
"960x512",
|
||||
"1024x512",
|
||||
"1024x576",
|
||||
"1536x640",
|
||||
"1344x768",
|
||||
"1216x832",
|
||||
"1152x896",
|
||||
"1024x1024"
|
||||
{
|
||||
"label": "SD",
|
||||
"value": "512x512"
|
||||
},
|
||||
{
|
||||
"label": "HD",
|
||||
"value": "768x768"
|
||||
},
|
||||
{
|
||||
"label": "Full HD",
|
||||
"value": "1024x1024"
|
||||
},
|
||||
{
|
||||
"label": "4k",
|
||||
"value": "2048x2048"
|
||||
},
|
||||
{
|
||||
"label": "SVD",
|
||||
"value": "1024x576"
|
||||
}
|
||||
]
|
||||
@ -712,11 +712,11 @@ class EmptyLatentImageCustomPresets:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
with open(os.path.join(script_directory, 'custom_dimensions.json')) as f:
|
||||
dimensions = json.load(f)
|
||||
dimensions_dict = json.load(f)
|
||||
return {
|
||||
"required": {
|
||||
"dimensions": (
|
||||
dimensions,
|
||||
[f"{d['label']} - {d['value']}" for d in dimensions_dict],
|
||||
),
|
||||
|
||||
"invert": ("BOOLEAN", {"default": False}),
|
||||
@ -738,22 +738,18 @@ The choices are loaded from 'custom_dimensions.json' in the nodes folder.
|
||||
"""
|
||||
|
||||
def generate(self, dimensions, invert, batch_size):
|
||||
from nodes import EmptyLatentImage
|
||||
result = [x.strip() for x in dimensions.split('x')]
|
||||
|
||||
# Remove the aspect ratio part
|
||||
result[0] = result[0].split('(')[0].strip()
|
||||
result[1] = result[1].split('(')[0].strip()
|
||||
|
||||
if invert:
|
||||
width = int(result[1].split(' ')[0])
|
||||
height = int(result[0])
|
||||
else:
|
||||
width = int(result[0])
|
||||
height = int(result[1].split(' ')[0])
|
||||
latent = EmptyLatentImage().generate(width, height, batch_size)[0]
|
||||
|
||||
return (latent, int(width), int(height),)
|
||||
from nodes import EmptyLatentImage
|
||||
# Split the string into label and value
|
||||
label, value = dimensions.split(' - ')
|
||||
# Split the value into width and height
|
||||
width, height = [x.strip() for x in value.split('x')]
|
||||
|
||||
if invert:
|
||||
width, height = height, width
|
||||
|
||||
latent = EmptyLatentImage().generate(int(width), int(height), batch_size)[0]
|
||||
|
||||
return (latent, int(width), int(height),)
|
||||
|
||||
class WidgetToString:
|
||||
@classmethod
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user