Skip to content

Commit 4484b93

Browse files
authored
fix(api-nodes): do not downscale the input image for Topaz Enhance (Comfy-Org#11768)
1 parent bd0e682 commit 4484b93

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

comfy_api_nodes/nodes_topaz.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from io import BytesIO
33

44
import aiohttp
5-
import torch
65
from typing_extensions import override
76

87
from comfy_api.latest import IO, ComfyExtension, Input
@@ -138,7 +137,7 @@ def define_schema(cls):
138137
async def execute(
139138
cls,
140139
model: str,
141-
image: torch.Tensor,
140+
image: Input.Image,
142141
prompt: str = "",
143142
subject_detection: str = "All",
144143
face_enhancement: bool = True,
@@ -153,7 +152,9 @@ async def execute(
153152
) -> IO.NodeOutput:
154153
if get_number_of_images(image) != 1:
155154
raise ValueError("Only one input image is supported.")
156-
download_url = await upload_images_to_comfyapi(cls, image, max_images=1, mime_type="image/png")
155+
download_url = await upload_images_to_comfyapi(
156+
cls, image, max_images=1, mime_type="image/png", total_pixels=4096*4096
157+
)
157158
initial_response = await sync_op(
158159
cls,
159160
ApiEndpoint(path="/proxy/topaz/image/v1/enhance-gen/async", method="POST"),

comfy_api_nodes/util/upload_helpers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ async def upload_images_to_comfyapi(
4949
mime_type: str | None = None,
5050
wait_label: str | None = "Uploading",
5151
show_batch_index: bool = True,
52+
total_pixels: int = 2048 * 2048,
5253
) -> list[str]:
5354
"""
5455
Uploads images to ComfyUI API and returns download URLs.
@@ -63,7 +64,7 @@ async def upload_images_to_comfyapi(
6364

6465
for idx in range(num_to_upload):
6566
tensor = image[idx] if is_batch else image
66-
img_io = tensor_to_bytesio(tensor, mime_type=mime_type)
67+
img_io = tensor_to_bytesio(tensor, total_pixels=total_pixels, mime_type=mime_type)
6768

6869
effective_label = wait_label
6970
if wait_label and show_batch_index and num_to_upload > 1:

0 commit comments

Comments
 (0)