diff --git a/clientlibs/types.js b/clientlibs/types.js index 16f452c..d3cf86b 100644 --- a/clientlibs/types.js +++ b/clientlibs/types.js @@ -1,4 +1,4 @@ -const DEFAULT_BGCOLOR = "#6c5ce7"; +const DEFAULT_BGCOLOR = "#5345bf"; const DEFAULT_DIMENSIONS_LIST = { "Square (512x512)": "512x512", diff --git a/modules/bgremoval.py b/modules/bgremoval.py index 5bdc1fb..180f345 100644 --- a/modules/bgremoval.py +++ b/modules/bgremoval.py @@ -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", } ] diff --git a/modules/imageInference.py b/modules/imageInference.py index 9863b97..1e4ad96 100644 --- a/modules/imageInference.py +++ b/modules/imageInference.py @@ -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, } diff --git a/modules/imageMasking.py b/modules/imageMasking.py index c1e496c..3d0d627 100644 --- a/modules/imageMasking.py +++ b/modules/imageMasking.py @@ -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", } ] diff --git a/modules/photoMaker.py b/modules/photoMaker.py index 12f0861..067d208 100644 --- a/modules/photoMaker.py +++ b/modules/photoMaker.py @@ -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", } ] diff --git a/modules/upscaler.py b/modules/upscaler.py index 967a894..a332fd5 100644 --- a/modules/upscaler.py +++ b/modules/upscaler.py @@ -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", } ] diff --git a/modules/utils/runwareUtils.py b/modules/utils/runwareUtils.py index e40d610..298636f 100644 --- a/modules/utils/runwareUtils.py +++ b/modules/utils/runwareUtils.py @@ -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)