PreResize
Get your source image's dimensions right before pixelizing
- img
- img
PreResize is the quiet setup node in this pack's pixel-art trio - it exists specifically to sit in front of PixelOE (or OutlineExpansion) and normalize your source image's dimensions before the actual pixelization runs. Pixel-art conversion algorithms generally look better when the source resolution has a sane relationship to the target pixel grid; feed them something wildly off and block sizes can come out uneven or inconsistent across the image. This node fixes that up front rather than making you fight artifacts after the fact.
The inputs and outputs that matter
img- your source image.target_pixels(1–1024, default 256) - roughly how many pixel-art "blocks" you want across the image's shorter dimension once it's pixelized downstream. This is the number to think about in terms of final sprite size, not source resolution.pixel_size(1–32, default 4) - should match whatever you're setting on the downstreamPixelOEorOutlineExpansionnode. Mismatched values between this node and the one after it is the most common cause of uneven-looking blocks.device-default/cpu/cuda/mps.
One output, img, sized and ready to hand to PixelOE. Note that unlike PixelOE's own pixel_size field (which goes up to 32), target_pixels here tops out at 1024 - it's operating in a different unit, the eventual pixel-art grid count rather than the block size, so don't expect the two numbers to feel like they're on the same scale.
How to install it
Search ComfyUI-HakuImg in ComfyUI Manager, or:
cd ComfyUI/custom_nodes
git clone --recurse-submodules https://github.com/licyk/ComfyUI-HakuImg
Restart ComfyUI, find it under Image → HakuImg.
Common issues & troubleshooting
Missing from the node menu along with PixelOE and OutlineExpansion, but nothing else. All three share the same underlying algorithm, which the pack pulls in as a git submodule - the README's install command is git clone --recurse-submodules specifically because a plain clone leaves that piece out. Check the ComfyUI startup console for an import error on this pack and re-clone with the flag if you find one.
Pixel-art output has inconsistent block sizes even after using this node. Double-check that pixel_size here matches pixel_size on the PixelOE (or OutlineExpansion) node downstream - they need to agree for the two steps to hand off cleanly.
Not sure you need this node at all. You often don't. PixelOE handles most source resolutions fine on its own via its mode setting. Treat PreResize as a fix to reach for specifically when a large or oddly-proportioned source image is producing uneven-looking pixel blocks, not as a mandatory first step in every pixel-art chain.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| img | IMAGE | — | |
| target_pixels | INT | 2561–1024 | — |
| pixel_size | INT | 41–32 | — |
| device | COMBO | 4 options: default, cpu, cuda, mps |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| img | IMAGE | — |