{"record":{"id":"0c879e9663797ef7","repo":"invoke-ai/InvokeAI","slug":"source-longer-side-long-side-px-is-smaller-than","errorCode":null,"errorMessage":"Source longer side ({long_side}px) is smaller than the Wan pixel grid ({multiple}px). Use an input image at least {multiple}px on its longer side.","messagePattern":"Source longer side \\((.+?)px\\) is smaller than the Wan pixel grid \\((.+?)px\\)\\. Use an input image at least (.+?)px on its longer side\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/wan_ideal_dimensions.py","lineNumber":70,"sourceCode":"    multiple: int,\n) -> tuple[int, int]:\n    \"\"\"Scale a source W×H so its shorter side equals ``target_short_side``, then\n    snap each dimension to ``multiple`` using the requested rounding mode.\n\n    ``multiple`` is the Wan pixel-grid constraint (16 for the 8x-VAE I2V/T2V\n    models, 32 for the 16x-VAE TI2V-5B). Shared by both ideal-dimensions nodes.\n    \"\"\"\n    short = min(width, height)\n    if short <= 0:\n        raise ValueError(\"Source dimensions must be positive.\")\n\n    # Reject sources so narrow that the scaled long side is still under one Wan\n    # pixel grid. The downstream clamp to ``max(w, multiple)`` would otherwise\n    # silently return multiple×multiple, which has no relation to the requested\n    # aspect ratio — better to fail fast and have the workflow author fix inputs.\n    long_side = max(width, height)\n    if long_side < multiple:\n        raise ValueError(\n            f\"Source longer side ({long_side}px) is smaller than the Wan pixel grid ({multiple}px). \"\n            f\"Use an input image at least {multiple}px on its longer side.\"\n        )\n\n    scale = target_short_side / short\n    raw_w = width * scale\n    raw_h = height * scale\n\n    if rounding == \"floor\":\n        w = int(raw_w // multiple) * multiple\n        h = int(raw_h // multiple) * multiple\n    elif rounding == \"ceiling\":\n        w = int(math.ceil(raw_w / multiple)) * multiple\n        h = int(math.ceil(raw_h / multiple)) * multiple\n    else:  # nearest\n        w = round(raw_w / multiple) * multiple\n        h = round(raw_h / multiple) * multiple\n","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/wan_ideal_dimensions.py#L52-L88","documentation":"Wan models require output dimensions snapped to a pixel grid (16px for 8x-VAE models, 32px for the 16x-VAE TI2V-5B). If the source's longer side is smaller than that grid multiple, the clamp would silently collapse the result to multiple x multiple, destroying the requested aspect ratio. The node raises instead so the workflow author fixes the input image.","triggerScenarios":"Feeding a tiny image (longer side < 16 or < 32 px, e.g. a 12x12 thumbnail) into Wan Ideal Dimensions; using multiple=32 (TI2V-5B) with a small image whose long side is under 32px.","commonSituations":"Downscaled or placeholder images in automated pipelines; switching to the 16x-VAE model (multiple=32) without enlarging previously-fine small inputs.","solutions":["Upscale or replace the input image so its longer side is at least the grid multiple (>=16px, or >=32px for TI2V-5B)","Use the ideal-dimensions node matching your model's multiple (16 vs 32)","Check upstream resize/crop nodes that may have shrunk the image"],"exampleFix":"// before\ninputImage: 12x20px, multiple=16  -> error\n// after\ninputImage: 480x800px (or upscaled) then Wan Ideal Dimensions","handlingStrategy":"validation","validationCode":"multiple = 32 if model_is_16x_vae else 16\nif max(width, height) < multiple:\n    raise ValueError(f\"image longer side must be >= {multiple}px\")","typeGuard":null,"tryCatchPattern":"try:\n    dims = ideal_dims.invoke(context)\nexcept ValueError as e:\n    if 'smaller than the Wan pixel grid' in str(e):\n        upscale_image_to_at_least(multiple)\n    else:\n        raise","preventionTips":["Use input images with a reasonable resolution (>= grid multiple)","Match the multiple (16 vs 32) to your Wan model variant","Avoid aggressive downsizing upstream in the pipeline"],"tags":["invokeai","wan","dimensions","validation"],"backgroundTag":"input-image-too-small","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}