Nodes/ComfyUI PixelArt Detector/🕹️PixelArt Detector (+Save)
ComfyUI Node

🕹️PixelArt Detector (+Save)

Downscale, quantize, and save as WebP

By dimtoneff·Created 3 years ago·Updated 10 months ago· 429
🕹️PixelArt Detector (+Save)
  • images
    filename_prefix%date%/PixelArt
    reduce_palettefalse
    reduce_palette_max_colors128
    webp_mode
    compression80
    save_jpgfalse
    save_exiftrue
    resize_w512
    resize_h512
    resize_typecontain

    Every other node in this pack ends with an image you still have to save. PixelArtDetectorSave is the one that finishes the job: it runs the same 1:1 pixel-downscale and optional palette reduction as the (Image->) node, optionally resizes, and writes the result to disk as WebP - with your whole workflow embedded in the file's EXIF so you can drag the image back into ComfyUI later and get the exact graph that made it. It's an output node: no image output, just a saved file.

    What it does, step by step

    Feed it an IMAGE and it: converts to PIL, detects the true pixel scale with the same Astropulse-based algorithm the rest of the pack uses, downsamples to that size, reduces the palette if you asked (elbow-method k selection, so reduce_palette_max_colors is an upper bound), resizes to your target W/H if those are above 64, and saves. The filename counter is handled automatically, and %date% in the prefix expands to YYYY-MM-DD.

    The workflow-embedding is the hidden feature. save_exif (on by default) writes the prompt and workflow JSON into the WebP/JPEG EXIF, and the pack ships a small front-end script that makes those files drag-and-drop loadable back into ComfyUI. That's the pack's share-your-workflow culture built in - the image is the workflow file.

    The inputs that matter

    • filename_prefix - default %date%/PixelArt. Path structure is preserved under your output folder.
    • reduce_palette / reduce_palette_max_colors - same behavior as the (Image->) node; off unless you want the quantized retro look on save.
    • resize_w / resize_h - target size, default 512×512. Set both to 0 to disable resizing and keep the auto-detected 1:1 pixel size. Note the threshold is 64, not 0 - anything below 64 counts as "off."
    • resize_type - contain (fit inside, preserve AR), fit (crop to fill), or stretch (distort to exact size).
    • webp_mode - lossy or lossless.
    • compression - the one genuinely confusing input. The README is blunt about it: in lossless mode it's the compression effort (100 = smallest file, 1 = biggest), in lossy mode it's the opposite (100 = least compression / biggest file). So don't assume "high = small" - it flips depending on mode.
    • save_jpg - also write a JPEG alongside.
    • save_exif - embed the workflow/prompt metadata. Turn off if you want clean files or privacy.

    Where it fits

    This is the node you drop at the end of the pack's stock workflow when you want a real file out and a small one. Pixel art is flat-color by nature, so WebP lossless is a legitimately good format for it - a quantized 128-color sprite compresses absurdly well. If your downstream tool wants PNG, use the default Save Image node instead; the (Image->) node exists precisely so you can keep the image in the graph and save it however you like.

    Installing the pack

    This node ships in dimtoneff/ComfyUI-PixelArt-Detector. Install via ComfyUI Manager (search "ComfyUI PixelArt Detector") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/dimtoneff/ComfyUI-PixelArt-Detector
    

    Restart ComfyUI. First load auto-installs opencv-python, scipy, pyclustering, Pillow and numpy; pyclustering comes from a prebuilt wheel the author hosts (x86_64 only), so on Apple Silicon or exotic Python builds you may need to pip install pyclustering yourself.

    Gotchas

    • The compression slider is not a quality/quality tradeoff you can set once - its meaning inverts between lossy and lossless. If your files surprise you, that's why.
    • resize threshold is 64, not 0 - setting W/H to 1 still disables resize, but it's the README's "set to 0" that people actually remember.
    • Old node instances embedded in workflows won't update in place - delete the node and re-add it from Image/PixelArt.
    • If your WebP comes out without the embedded workflow, save_exif got turned off, or you're on a ComfyUI build with --disable-metadata.
    Categoryimage/PixelArt🕹️

    Inputs (11)

    NameTypeDefaultDescription
    imagesIMAGE
    filename_prefixSTRING%date%/PixelArt
    reduce_paletteBOOLEANfalse
    reduce_palette_max_colorsINT1281–256
    webp_modeCOMBO2 options: lossy, lossless
    compressionINT801–100
    save_jpgBOOLEANfalse
    save_exifBOOLEANtrue
    resize_wINT5120–2048
    resize_hINT5120–2048
    resize_typeCOMBOcontain3 options: contain, fit, stretch

    Outputs (0)

    No outputs