Comfy-Org/ComfyUI · error · ValueError

Output size ({width * requested_scale}x{height * requested_s

Error message

Output size ({width * requested_scale}x{height * requested_scale} = {output_pixels:,} pixels) exceeds maximum allowed size of {max_output_pixels:,} pixels. Use a smaller input image or lower scale factor.

What it means

Raised by the Magnific upscale node (comfy_api_nodes/nodes_magnific.py:200) when height*width*scale^2 exceeds 25,300,000 output pixels and auto_downscale is disabled. With auto_downscale enabled the node instead picks a lower scale (≤2x downscale of server-upscaled output) and downsizes the input, so this error only fires on the manual path.

Source

Thrown at comfy_api_nodes/nodes_magnific.py:200

                for candidate in [16, 8, 4, 2]:
                    if candidate > requested_scale:
                        continue
                    scale_output_pixels = input_pixels * candidate * candidate
                    if scale_output_pixels <= max_output_pixels:
                        scale = candidate
                        max_input_pixels = None
                        break
                    downscale_ratio = math.sqrt(scale_output_pixels / max_output_pixels)
                    if downscale_ratio <= 2.0:
                        scale = candidate
                        max_input_pixels = max_output_pixels // (candidate * candidate)
                        break

                if max_input_pixels is not None:
                    image = downscale_image_tensor(image, total_pixels=max_input_pixels)
                scale_factor = f"{scale}x"
            else:
                raise ValueError(
                    f"Output size ({width * requested_scale}x{height * requested_scale} = {output_pixels:,} pixels) "
                    f"exceeds maximum allowed size of {max_output_pixels:,} pixels. "
                    f"Use a smaller input image or lower scale factor."
                )

        final_height, final_width = get_image_dimensions(image)
        actual_scale = int(scale_factor.rstrip("x"))
        price_usd = _calculate_magnific_upscale_price_usd(final_width, final_height, actual_scale)

        initial_res = await sync_op(
            cls,
            ApiEndpoint(path="/proxy/freepik/v1/ai/image-upscaler", method="POST"),
            response_model=TaskResponse,
            data=ImageUpscalerCreativeRequest(
                image=(await upload_images_to_comfyapi(cls, image, max_images=1, total_pixels=None))[0],
                scale_factor=scale_factor,
                optimized_for=optimized_for,
                creativity=creativity,

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Enable auto_downscale and let the node choose a compliant scale/input size.
  2. Or lower the scale_factor widget (e.g. 4x → 2x).
  3. Or pre-downscale the input image so height*width*scale^2 stays ≤ 25,300,000.
Defensive patterns

Strategy: validation

Validate before calling

MAX_OUT_PIXELS = 25_300_000
h, w = image.shape[-2], image.shape[-3]  # per your tensor layout via get_image_dimensions
scale = int(scale_factor.rstrip("x"))
if h * w * scale * scale > MAX_OUT_PIXELS:
    scale_factor = f"{int(math.sqrt(MAX_OUT_PIXELS / (h * w)))}x"  # or enable auto_downscale

Prevention

When it happens

Trigger: Executing the Magnific node with auto_downscale=False and e.g. a 6000x4000 input at 4x (96M pixels > 25.3M), or any large image combined with a high scale factor.

Common situations: User disables auto_downscale wanting the full requested scale; upscaling already-large panoramas or max-resolution outputs; stacked upscaler workflows feeding progressively larger inputs.

Related errors


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