The Recraft Crisp Upscale node uses Recraft’s API to improve image resolution and clarity.
Parameters
Basic Parameters
Parameter | Type | Default | Description |
---|
image | image | - | Input image to be upscaled |
Output
Output | Type | Description |
---|
IMAGE | image | Upscaled and enhanced output image |
Source Code
[Node source code (Updated on 2025-05-03)]
class RecraftCrispUpscaleNode:
"""
Upscale image synchronously.
Enhances a given raster image using ‘crisp upscale’ tool, increasing image resolution, making the image sharper and cleaner.
"""
RETURN_TYPES = (IO.IMAGE,)
DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value
FUNCTION = "api_call"
API_NODE = True
CATEGORY = "api node/image/Recraft"
RECRAFT_PATH = "/proxy/recraft/images/crispUpscale"
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"image": (IO.IMAGE, ),
},
"optional": {
},
"hidden": {
"auth_token": "AUTH_TOKEN_COMFY_ORG",
},
}
def api_call(
self,
image: torch.Tensor,
auth_token=None,
**kwargs,
):
images = []
total = image.shape[0]
pbar = ProgressBar(total)
for i in range(total):
sub_bytes = handle_recraft_file_request(
image=image[i],
path=self.RECRAFT_PATH,
auth_token=auth_token,
)
images.append(torch.cat([bytesio_to_image_tensor(x) for x in sub_bytes], dim=0))
pbar.update(1)
images_tensor = torch.cat(images, dim=0)
return (images_tensor,)