Comfy-Org/ComfyUI · error · Exception

Mask and Image must be the same size

Error message

Mask and Image must be the same size

What it means

Error "Mask and Image must be the same size" thrown in Comfy-Org/ComfyUI.

Source

Thrown at comfy_api_nodes/nodes_ideogram.py:309

            # 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
            if mask.shape[1:] != image.shape[1:-1]:
                raise Exception("Mask and Image must be the same size")

            # Process image
            img_np = (input_tensor.numpy() * 255).astype(np.uint8)

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Resize the mask so it matches the image dimensions.

When it happens

Trigger: Thrown at comfy_api_nodes/nodes_ideogram.py:309 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/54c7ab80ccad45a1. Report an issue: GitHub.