mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-09-06 11:37:03 +08:00
Invert and resize mask for Ideogram V3 node to match masking conventions (#158)
This commit is contained in:
parent
79edd2dde7
commit
5b523ce4f4
@ -21,6 +21,7 @@ from comfy_api_nodes.apis.client import (
|
|||||||
from comfy_api_nodes.apinode_utils import (
|
from comfy_api_nodes.apinode_utils import (
|
||||||
download_url_to_bytesio,
|
download_url_to_bytesio,
|
||||||
bytesio_to_image_tensor,
|
bytesio_to_image_tensor,
|
||||||
|
resize_mask_to_image,
|
||||||
)
|
)
|
||||||
|
|
||||||
V1_V1_RES_MAP = {
|
V1_V1_RES_MAP = {
|
||||||
@ -649,6 +650,10 @@ class IdeogramV3(ComfyNodeABC):
|
|||||||
|
|
||||||
# Process image and mask
|
# Process image and mask
|
||||||
input_tensor = image.squeeze().cpu()
|
input_tensor = image.squeeze().cpu()
|
||||||
|
# Resize mask to match image dimension
|
||||||
|
mask = resize_mask_to_image(mask, image, allow_gradient=False)
|
||||||
|
# Invert mask, as Ideogram API will edit black areas instead of white areas (opposite of convention).
|
||||||
|
mask = 1.0 - mask
|
||||||
|
|
||||||
# Validate mask dimensions match image
|
# Validate mask dimensions match image
|
||||||
if mask.shape[1:] != image.shape[1:-1]:
|
if mask.shape[1:] != image.shape[1:-1]:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user