Added Output Format Selector And Adjusted Color Contrast

This commit is contained in:
Jack
2025-01-13 18:58:46 +02:00
parent ed40a7efd8
commit 54d6e8b4a8
7 changed files with 31 additions and 7 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
const DEFAULT_BGCOLOR = "#6c5ce7";
const DEFAULT_BGCOLOR = "#5345bf";
const DEFAULT_DIMENSIONS_LIST = {
"Square (512x512)": "512x512",
+3 -1
View File
@@ -46,6 +46,7 @@ class bgremoval:
"min": 1,
"max": 255,
}),
**rwUtils.RUNWARE_REMBG_OUTPUT_FORMATS,
}
}
@@ -62,6 +63,7 @@ class bgremoval:
alphaMattingForegroundThreshold = kwargs.get("Alpha Matting Foreground Threshold", 240)
alphaMattingBackgroundThreshold = kwargs.get("Alpha Matting Background Threshold", 10)
alphaMattingErodeSize = kwargs.get("Alpha Matting Erode Size", 10)
outputFormat = kwargs.get("outputFormat", "WEBP")
genConfig = [
{
@@ -71,7 +73,7 @@ class bgremoval:
"postProcessMask": postProcessMask,
"returnOnlyMask": returnOnlyMask,
"alphaMatting": alphaMatting,
"outputFormat": "WEBP",
"outputFormat": outputFormat,
"outputType": "base64Data",
}
]
+4 -2
View File
@@ -122,6 +122,7 @@ class txt2img:
"VAE": ("RUNWAREVAE", {
"tooltip": "Connect a Runware VAE Node to help the model generate images that align with the desired structure.",
}),
**rwUtils.RUNWARE_OUTPUT_FOMRATS,
}
}
@@ -163,7 +164,8 @@ class txt2img:
cfgScale = kwargs.get("cfgScale", 6.5)
seed = kwargs.get("seed")
batchSize = kwargs.get("batchSize", 1)
outputFormat = kwargs.get("outputFormat", "WEBP")
if (maskImage is not None and seedImage is None):
raise Exception("Mask Image Requires Seed Image To Be Provided!")
@@ -180,7 +182,7 @@ class txt2img:
"scheduler": scheduler,
"clipSkip": clipSkip,
"seed": seed,
"outputFormat": "WEBP",
"outputFormat": outputFormat,
"outputType": "base64Data",
"numberResults": batchSize,
}
+3 -1
View File
@@ -42,6 +42,7 @@ class imageMasking:
"min": 0,
"max": 20,
}),
**rwUtils.RUNWARE_OUTPUT_FOMRATS,
},
}
@@ -59,6 +60,7 @@ class imageMasking:
maxDetections = kwargs.get("Max Detections")
maskPadding = kwargs.get("Mask Padding")
maskBlur = kwargs.get("Mask Blur")
outputFormat = kwargs.get("outputFormat", "WEBP")
model_mapping = {
"face_yolov8n": "runware:35@1",
@@ -87,7 +89,7 @@ class imageMasking:
"model": detectionModel,
"confidence": confidence,
"maxDetections": maxDetections,
"outputFormat": "WEBP",
"outputFormat": outputFormat,
"outputType": "base64Data",
}
]
+3 -1
View File
@@ -96,6 +96,7 @@ class photoMaker:
"min": 1,
"max": 10,
}),
**rwUtils.RUNWARE_OUTPUT_FOMRATS,
},
"optional": {
"Image 2": ("IMAGE", {
@@ -145,6 +146,7 @@ class photoMaker:
clipSkip = kwargs.get("clipSkip", 0)
seed = kwargs.get("seed")
batchSize = kwargs.get("batchSize", 1)
outputFormat = kwargs.get("outputFormat", "WEBP")
imageList = [rwUtils.convertTensor2IMG(image1)]
if (image2 is not None):
@@ -171,7 +173,7 @@ class photoMaker:
"CFGScale": cfgScale,
"clipSkip": clipSkip,
"numberResults": batchSize,
"outputFormat": "WEBP",
"outputFormat": outputFormat,
"outputType": "base64Data",
}
]
+3 -1
View File
@@ -14,6 +14,7 @@ class upscaler:
"min": 2,
"max": 4,
}),
**rwUtils.RUNWARE_OUTPUT_FOMRATS,
},
}
@@ -25,6 +26,7 @@ class upscaler:
def upscale(self, **kwargs):
image = kwargs.get("Image")
upscaleFactor = kwargs.get("upscaleFactor", 2)
outputFormat = kwargs.get("outputFormat", "WEBP")
genConfig = [
{
@@ -32,7 +34,7 @@ class upscaler:
"taskUUID": rwUtils.genRandUUID(),
"inputImage": rwUtils.convertTensor2IMG(image),
"upscaleFactor": upscaleFactor,
"outputFormat": "WEBP",
"outputFormat": outputFormat,
"outputType": "base64Data",
}
]
+14
View File
@@ -15,6 +15,20 @@ import io
load_dotenv()
RUNWARE_OUTPUT_FOMRATS = {
"outputFormat": (["WEBP", "PNG", "JPG"], {
"default": "WEBP",
"tooltip": "Choose the output image format."
})
}
RUNWARE_REMBG_OUTPUT_FORMATS = {
"outputFormat": (["WEBP", "PNG"], {
"default": "WEBP",
"tooltip": "Choose the output image format."
})
}
RUNWARE_API_BASE_URL = "https://api.runware.ai/v1"
session = requests.Session()
adapter = HTTPAdapter(pool_connections=10, pool_maxsize=10)