Update image saving with timestamps, fix upscaler steps placement, rename vectorize output to Image

This commit is contained in:
Sirshendu Ganguly
2026-01-23 23:21:13 -05:00
parent 91646ada84
commit 7b570f7b4b
47 changed files with 193 additions and 366 deletions
+6 -32
View File
@@ -1,14 +1,4 @@
from .utils import runwareUtils as rwUtils
import base64
import io
class SVGData:
"""Wrapper class to match RecraftIO.SVG format for SaveSVGNode"""
def __init__(self, svgContent):
svgBytes = io.BytesIO(svgContent.encode('utf-8'))
self.data = [svgBytes]
class vectorize:
@@ -35,12 +25,12 @@ class vectorize:
DESCRIPTION = "Convert images to vector format using Runware's vectorization service."
FUNCTION = "vectorizeImage"
RETURN_TYPES = ("SVG",)
RETURN_NAMES = ("SVG",)
RETURN_TYPES = ("STRING",)
RETURN_NAMES = ("Image",)
CATEGORY = "Runware"
def vectorizeImage(self, **kwargs):
"""Vectorize image and return SVG data"""
"""Vectorize image and return SVG URL"""
image = kwargs.get("Image")
modelName = kwargs.get("Model", "recraft:1@1")
@@ -59,9 +49,9 @@ class vectorize:
self._validateResponse(genResult)
svgData = self._extractSvgData(genResult)
svg_url = rwUtils.extractImageURLs(genResult)
return (svgData,)
return (svg_url,)
def _buildGenConfig(self, model, imageUuid):
"""Build generation configuration for API request"""
@@ -72,7 +62,7 @@ class vectorize:
"inputs": {
"image": imageUuid
},
"outputType": "base64Data",
"outputType": "URL",
"outputFormat": "svg",
}]
@@ -81,22 +71,6 @@ class vectorize:
if "errors" in genResult:
errorMessage = genResult["errors"][0]["message"]
raise Exception(f"Vectorization failed: {errorMessage}")
if "data" not in genResult or len(genResult["data"]) == 0:
raise Exception("No data returned from vectorization API")
def _extractSvgData(self, genResult):
"""Extract SVG data from API response"""
resultData = genResult["data"][0]
if "imageBase64Data" not in resultData:
raise Exception("imageBase64Data not found in response")
base64Svg = resultData["imageBase64Data"]
svgContent = base64.b64decode(base64Svg).decode('utf-8')
svgData = SVGData(svgContent)
return svgData
# Node class mappings