TinyPNG Compress
PNG compression via a real API — yes, you need a key
- image
- image
- info
TinyPNG Compress is the rare ComfyUI node whose name doesn't oversell: it really does call the TinyPNG API, and it really does need an API key. No local magic, no model downloads - it ships your image to a third-party compression service and ships a smaller one back. You'd reach for it when the thing leaving your ComfyUI is destined for a website, a client, or a marketplace listing where a 3 MB PNG is a problem and you specifically need PNG, not just "smaller."
Where does it sit in a workflow? Right at the end. Generate, upscale, then wire the final IMAGE into this node instead of straight into a Save Image. The compressed tensor comes out the image output, which you feed into your usual Save node - the actual disk-size win only happens when you do that last step.
How it works
The node converts each frame of your batch to a PNG in memory, sends it to TinyPNG's servers over the tinify Python SDK, and waits for the compressed bytes to come back. It decodes those, converts them back to a IMAGE tensor, and moves on to the next frame. Two things follow from that design, and both surprise people.
First: it's a network round trip per image, done synchronously. A batch of eight frames is eight API calls, one after another. Second: every frame burns one compression credit on your TinyPNG account. The free tier is around 500 images a month, then it's pay-per-image - so a busy batch-heavy pipeline can chew through your allowance faster than you'd expect. This is not a node you want in the middle of a real-time iteration loop; it's a post-processing step you run once, on the output that's actually going somewhere.
The inputs that matter
Only a handful are worth touching:
- api_key - required. Grab one from https://tinypng.com/developers. The node hard-fails with an error if it's blank, no second chances.
- operation -
compress(the default) just shrinks the file.smart_resizeadditionally resizes, using TinyPNG's own resize API. - resize_method - only read when
smart_resizeis set:scale(fit one dimension, keep aspect),fit,cover, orthumb. - width / height - the target size for smart resizing. Leave both at 0 and the image passes through untouched (it still counts as an API call, so don't do that).
- preserve_copyright / preserve_creation / preserve_location - flags telling TinyPNG which EXIF/IPTC chunks to keep instead of stripping.
The info output is the one you actually care about: a string like batch=1, input=3145728 bytes, output=891289 bytes, saved=71.64%. Wire it into a Show Text node and you get a running tally of what the service saved you. That's also how you'll sanity-check that anything actually happened.
Installing it
The easy way: ComfyUI Manager → Install Custom Nodes → search ComfyUI TinyPNG → install, restart. Manual install is the usual two-liner:
cd ComfyUI/custom_nodes
git clone https://github.com/knottttt/comfyui-tinyPNG.git
cd comfyui-tinyPNG
pip install -r requirements.txt
Dependencies are blessedly light: just tinify and Pillow. No models, no weights, nothing to hunt down. Restart ComfyUI and the node shows up under image/TinyPNG.
Where people get burned
The key is a plaintext string input, which means it gets saved into your workflow JSON - and ComfyUI embeds the workflow into the metadata of output PNGs. Share a finished image or a workflow file that passed through this node and you've shared your API key with whoever drags it back into ComfyUI. Treat that key like a password; consider a throwaway one for shared workflows.
The machine running ComfyUI needs outbound internet and a clear path to TinyPNG's servers. Behind a proxy or firewall, the call just fails with a tinify error. And remember the round trip happens for every frame in the batch - feed it a 16-frame batch and you're waiting on 16 network calls before anything comes back.
One honest alternative: if your only goal is smaller files and you don't care about PNG specifically, ComfyUI's built-in Save WEBP often beats TinyPNG on size for free, locally, with zero keys and zero credits. TinyPNG Compress earns its keep when the deliverable must be a PNG - think game assets, store listings, or anything that's stuck with PNG by contract.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| api_key | STRING | — | |
| operation | COMBO | compress | 2 options: compress, smart_resize |
| resize_method | COMBO | scale | 4 options: scale, fit, cover, thumb |
| width | INT | 00–16384 | — |
| height | INT | 00–16384 | — |
| preserve_copyright | BOOLEAN | false | — |
| preserve_creation | BOOLEAN | false | — |
| preserve_location | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| info | STRING | — |