Comfy-Org/ComfyUI · error · ValueError

Output dimensions ({output_width}x{output_height}) exceed ma

Error message

Output dimensions ({output_width}x{output_height}) exceed maximum allowed resolution of {max_output_dimension}x{max_output_dimension} pixels. Use a smaller input image or lower scale factor.

What it means

Raised by the Magnific precision upscaler v2 node (comfy_api_nodes/nodes_magnific.py:364) when scaled output width or height exceeds 10,060 px and auto_downscale is disabled. The precision endpoint caps each dimension at 10060; with auto_downscale on, the node lowers the scale and downsizes the input instead of erroring.

Source

Thrown at comfy_api_nodes/nodes_magnific.py:364

                        continue
                    output_dim = max_dim * candidate
                    if output_dim <= max_output_dimension:
                        scale = candidate
                        max_input_pixels = None
                        break
                    downscale_ratio = output_dim / max_output_dimension
                    if downscale_ratio <= 2.0:
                        scale = candidate
                        max_input_dim = max_output_dimension // candidate
                        scale_ratio = max_input_dim / max_dim
                        max_input_pixels = int(width * height * scale_ratio * scale_ratio)
                        break

                if max_input_pixels is not None:
                    image = downscale_image_tensor(image, total_pixels=max_input_pixels)
                requested_scale = scale
            else:
                raise ValueError(
                    f"Output dimensions ({output_width}x{output_height}) exceed maximum allowed "
                    f"resolution of {max_output_dimension}x{max_output_dimension} pixels. "
                    f"Use a smaller input image or lower scale factor."
                )

        final_height, final_width = get_image_dimensions(image)
        price_usd = _calculate_magnific_upscale_price_usd(final_width, final_height, requested_scale)

        initial_res = await sync_op(
            cls,
            ApiEndpoint(path="/proxy/freepik/v1/ai/image-upscaler-precision-v2", method="POST"),
            response_model=TaskResponse,
            data=ImageUpscalerPrecisionV2Request(
                image=(await upload_images_to_comfyapi(cls, image, max_images=1, total_pixels=None))[0],
                scale_factor=requested_scale,
                flavor=flavor,
                sharpen=sharpen,
                smart_grain=smart_grain,

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Enable auto_downscale.
  2. Or pick a smaller scale_factor so width*scale and height*scale both stay ≤ 10060.
  3. Or pre-downscale/crop the long side of the input image.
Defensive patterns

Strategy: validation

Validate before calling

MAX_DIM = 10060
scale = int(scale_factor.strip("x"))
if image.shape[-2] * scale > MAX_DIM or image.shape[-3] * scale > MAX_DIM:
    scale_factor = f"{MAX_DIM // max(image.shape[-2], image.shape[-3])}x"  # or enable auto_downscale

Prevention

When it happens

Trigger: auto_downscale=False with e.g. a 6000x4000 input at 4x → 24000x16000 exceeds the 10060 per-side cap; any tall/wide image whose longest side times scale > 10060.

Common situations: Panoramic or extreme-aspect images whose one dimension blows past the cap even though total pixels seem fine; users chaining upscalers with auto_downscale off for determinism.

Related errors


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