Nearest Neighbor Upscale
Crisp nearest-neighbor upscaling, made for pixel art
- image
- IMAGE
Nearest Neighbor Upscale is the one upscaler in this pack that is supposed to make your image look blockier. It scales an image up by an integer factor (1–8) using nearest-neighbor sampling - every pixel becomes an scale_factor-sized square - which is exactly what pixel art needs and exactly wrong for almost everything else. If you've ever run a real upscaler on sprite art and watched it turn hard edges into soft smears, you know the problem this solves.
The KB's upscaling essay draws the crucial line between "more pixels" and "more detail." Most upscalers you'll read about are generative - they invent plausible detail. Nearest-neighbor is the opposite pole: it adds zero content, hallucinates zero detail, and runs in milliseconds, because the whole thing is just numpy's np.repeat along each axis. That's the entire algorithm. For pixel art, where every square pixel is a deliberate choice, that's not a limitation - it's the correct answer. It's also handy for doubling the size of UI elements, masks, or anything where you want a mathematically exact integer scale with no interpolation side effects.
The inputs are a single image and scale_factor (1–8, default 2). That's the whole interface. One thing to know before you get excited: like several nodes in this pack, it operates on the first frame only (image[0]). A batch of 16 sprite frames in, one scaled sprite out - so if you're scaling a whole sheet, you'll want to split the batch first (Batch to Image List is in this pack) and handle frames individually, or use a batch-aware node instead.
Two quirks worth flagging. First, scale_factor is an integer - you can't ask for 1.5×, and nearest-neighbor doesn't really make sense for fractional factors anyway; if you need a non-integer scale on pixel art, resize to a multiple then downscale. Second, the code still ships with a stack of debug print statements, so expect a small wall of "Shape of input tensor" noise in your console every run. Harmless, mildly annoying, and a good reminder that this is a hobbyist pack where polish is uneven.
Honest takes on alternatives: if you want to clean up rough pixel art rather than just scale it, the pack's Pixel Art Normalizer is the better fit - it detects the pixel grid and quantizes colors. If you want a genuine quality upscale on a photograph, neither of these is the tool; that's an ESRGAN-class model's job. And if you're upscaling to feed a detail-restoration pass, remember the hierarchy from the KB: nearest-neighbor adds nothing for a generator to work from.
Install: ComfyUI Manager → search "AnotherUtils", or cd ComfyUI/custom_nodes && git clone https://github.com/marcoc2/ComfyUI-AnotherUtils, then restart. No requirements, no model downloads.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| scale_factor | INT | 21–8 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |