PCK Pack — Save Image/Video (NVENC), Tag Cleanup, Mask Tools
Fast image and video saving (16-bit PNG, AVIF, NVENC h264/hevc/av1, small high-quality GIF), tag prompt cleanup with a report of what changed, soft-mask tools, an image comparer, Wan 2.2 boundary sigmas, and prompt writing with a vision model on llama.cpp or in ComfyUI
ComfyUI-PCK-Pack
Custom nodes for ComfyUI: faster image and video saving, tag prompt cleanup that tells you what it changed, soft-mask tools, and prompt writing with a local vision model.
中文文档见 README_zh.md。
| Node | What it does |
| --- | --- |
| Save Image (PCK) | png, webp, jpeg or avif, with 16-bit, 10-bit and alpha |
| Compare Images (PCK) | hover over the node to slide between two images |
| Save Video (PCK) | h264, hevc or av1 on your NVIDIA card, or animated WebP / GIF, with no ffmpeg to install |
| Drop Tags, Edit Tag Words, Apply Rule Set | remove or rewrite tags by category, and see which rule touched each one |
| Grow / Enhance Mask, Analyze Mask Threshold, Image Guided Mask Refine | grow, clean and refine soft masks without destroying their edges |
| VLM Prompt Builder, VLM Video Steering, VLM Request | turn a reference image into a generation prompt with a vision model, on your own llama.cpp server or inside ComfyUI |
| Tags Operation, Optimal Tile Size, Wan Boundary Sigmas, Gilbert Encrypt / Decrypt | small utilities |
Every input has a tooltip in ComfyUI; this page covers what the tooltips cannot.
Installation
In ComfyUI Manager, search for PCK Pack and install it, or run comfy node install pck-pack.
To install by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/PineCookie/ComfyUI-PCK-Pack.git
pip install -r ComfyUI-PCK-Pack/requirements.txt
Restart ComfyUI; the nodes are under PCK-Pack in the node menu.
- Needs a recent ComfyUI. Everything except one package (
pymatting, for Image Guided Mask Refine) already comes with it. - An NVIDIA card makes video saving fast, but is not required.
Save Image (PCK)
The built-in Save Image, with a choice of format.
| Format | Bit depth | Alpha | Workflow embedded |
| --- | --- | --- | --- |
| png | 8 or 16 | yes | yes |
| webp | 8 | yes | yes |
| jpeg | 8 | no | no |
| avif | 8 or 10 | at 8-bit | yes |
bit_depth—8-bit,high(16-bit png, 10-bit avif) orauto.autosaves 8-bit only when the image was loaded from an 8-bit file; anything generated or filtered saves ashigh.quality— for webp, jpeg and avif.100keeps webp lossless;90is a good lossy setting.workflow_png— also saves a png carrying the workflow, for jpeg, which cannot.- Sharing without your workflow: turn on
disable_metadatafor a clean file, andworkflow_pngas well to keep the workflow in a png next to it, named…_workflow.png. - Alpha comes from a 4-channel image, and is kept in png, webp and 8-bit avif. To attach a mask, put the core Join Image with Alpha node in front.
Compare Images (PCK)
Connect two images to left and right and hover over the node: a split follows the pointer, with
each image on its own side. Move the pointer away and left shows on its own.
- Batches: numbers above the image pick which one of a batch is compared. With only one input connected, a batch is compared against itself.
- Right-click menu: switch to hold the mouse to show right (useful when the images are almost identical) or swap left and right.
- Footer: shows the size of each image, so a resolution change is visible at a glance.
- The previews are temporary files without the workflow, like Preview Image, and the comparison is not stored in the workflow.
Made for the classic canvas; not tested in Nodes 2.0.
Save Video (PCK)
Saves an image batch as video, animated WebP or GIF. Encoding happens inside ComfyUI, and the colour conversion runs on the GPU, so NVENC reaches about 130-145 fps at 1920x1080 on a recent RTX card.
| Format | Bit depth | Encoder | Notes |
| --- | --- | --- | --- |
| h264 | 8 | NVENC or x264 | plays everywhere |
| hevc | 8 or 10 | NVENC or x265 | smaller files |
| av1 | 8 or 10 | NVENC or SVT-AV1 | smallest; NVENC AV1 needs an RTX 40 series card or newer |
| webp | 8 | Pillow | animated image with full colour and alpha; quality 100 is lossless |
| gif | — | own palette + ffmpeg paletteuse | animated image that plays anywhere; one palette for the whole clip |
- No NVIDIA card?
encoder: autofalls back to the software encoder for the same codec. - Two cards?
gpupicks which one encodes, so encoding can stay off the card that is generating. crfis quality: lower is better and larger. The scale differs per codec, so the defaults (19 / 21 / 30) are the place to start.audiois optional and is cut to the video's length.- Preview: right-click the node for Hide preview / Show preview; the choice is saved with the workflow. A gif previews as a still: ComfyUI's preview cannot play one on the node.
loopandpingpongare for the animated images, webp and gif.loopis how many times the animation repeats (0is forever);pingpongplays it forward and then backward, so a short clip loops without a jump.- Workflow: drag an
mp4orwebpback into ComfyUI to load its workflow.mkvandgifcannot carry one, so turn onworkflow_pngto get a…_workflow.pngnext to them. - Sharing without your workflow:
disable_metadatakeeps it out of the video. Turn onworkflow_pngtoo, and the png still carries it: a clean video to share, the recipe for you. - GIF
qualityanddither: atquality90 a GIF is about the size of gifski's default, at better quality. Lower keeps pixels that barely changed from the previous frame, for smaller files; 100 stores every change.ordereddither keeps files small;diffusionis a little smoother and about 1.3x larger. The palette keeps colours for small, saturated details such as eyes and lights.
Video is saved without alpha (webp keeps it), and an odd width or height is padded by one pixel.
Cleaning tag prompts
Three nodes for comma-separated tag prompts, such as the output of a tagger. Each one shows a report on the node, so you can see what happened and why.
in: 1girl, solo, blue_archive, long_hair, blonde_hair, (blue_eyes:1.2), maid_headdress,
serafuku, sitting, looking_at_viewer, smile, simple_background, watermark
out: 1girl, solo, blue_archive, sitting, looking_at_viewer, smile
long_hair -> (removed) [hair styles]
blonde_hair -> (removed) [feature colors]
(blue_eyes:1.2) -> (removed) [feature colors]
maid_headdress -> (removed) [accessories]
serafuku -> (removed) [clothing items]
simple_background -> (removed) [your terms]
watermark -> (removed) [metadata]
Drop Tags removes whole tags.
categories— tick what to drop: hair styles, feature colors, clothing items, accessories, background, lighting, camera framing, art style, metadata and more. Hover the input to see what each contains.terms— your own words.hairdrops every tag ending in it (blonde_hair,long_hair) but nothair_ornament. Switch the mode tois exactlyto match whole tags only.
Edit Tag Words rewrites tags instead of dropping them, keeping the noun:
purple_eyes → eyes, striped_shirt → shirt, (blue dress:1.3) → (dress:1.3).
Apply Rule Set applies a saved recipe in one node. Three ship with the pack:
drop-character— removes what identifies a character (hair, eyes, body, outfit, accessories) and keeps pose, action, expression, framing and style. Made for tagger output that feeds a new generation.strip-scenery— background, lighting and camera framing.strip-meta— watermarks, borders, resolution tags and baked-in text.
Chain the nodes to combine them. Good to know:
- Weights and escapes are understood.
(long hair:1.2)andkaga \(azur lane\)are matched as the tags they are, and an edited tag keeps its weight and escaping. - Well-known names are safe. The built-in lists skip names such as
blue_archiveorfairy_tailthat only look like a colour or a tail. A term you type yourself still reaches them. keepprotects any tag you list from every rule in that node.dry runshows the report without changing the text, to try settings on a live graph.- Tags, not sentences.
the girl with red hairis one tag to these nodes.
A rule set is a text file in the pack's rule_sets/ folder:
include: drop-character, strip-meta
terms: (azur lane)|holding phone
strip: colors, patterns
keep: red hood
include pulls in other rule sets, groups lists categories, terms your own words, strip the
families Edit Tag Words offers, and keep the tags nothing may touch. Refresh ComfyUI (R) after
adding a file.
Masks
Built for the soft alpha mattes that models like BiRefNet produce, where the edge detail is the point.
Load Image ─┬─► BiRefNet ─► Grow / Enhance Mask ─► Image Guided Mask Refine ─► soft alpha
└────────────────────────────────────────┘ (the image guides the refine)
Grow / Enhance Mask grows, shrinks, opens and blurs a mask on its continuous alpha, so soft
edges survive. remove_isolates and fill_holes clean up specks and holes; they only change the
regions they act on. topology_threshold decides what counts as foreground for those two and is
never applied to the output.
Analyze Mask Threshold finds a good topology_threshold from the mask's histogram: the valley
between the faint background residue and the real content. Wire its threshold output into
Grow / Enhance Mask, and its histogram output into a preview to see what it picked.
Image Guided Mask Refine turns a rough or binary mask into a soft matte using the source image,
so hair and fur get real coverage instead of a hard cut. It needs the pymatting package and runs
on the CPU, so it is slow on large images. preblur sets how wide a band around the edge is
re-solved.
Prompts from a reference image
VLM Prompt Builder and VLM Video Steering write the instructions; a vision model then writes the prompt. Run the model either way:
- On a server you run, with VLM Request (PCK) — llama.cpp, LM Studio, Ollama, vLLM or anything
else that speaks the OpenAI chat API. Wire
system_promptanduser_promptinto it, along with your images (the whole batch is sent). Refresh models lists what a server on this machine offers; for a server elsewhere, type the model name. Leavemodelempty to use whatever the server has loaded. Temperature, length and seed follow the server's own settings unless you setsamplingtocustom. Thinking models' reasoning comes out separately onthinking. - Inside ComfyUI, with the core Generate Text node — load a supported vision model (Qwen3-VL,
Qwen3.5, Gemma 4) with Load CLIP, wire
user_promptintopromptandsystem_promptintosystem_prompt, and keepuse_default_templateon, or the system prompt is ignored. VLM Prompt Builder writes the system and user prompts that tell a vision model how to describe your image: as natural language or tags, how detailed, how faithful, in which language, and what to leave out. It can also take existing tags and have the model correct or extend them.
VLM Video Steering adds motion and camera instructions when the prompt is for image-to-video.
Small utilities
- Tags Operation — union, intersection or difference of two tag strings, with de-duplication, and
merging that drops a tag contained in a longer one (
hairnext tored hair). - Optimal Tile Size — a scaled size and a matching tile size for tiled upscaling, aligned to a multiple you choose.
- Wan Boundary Sigmas (PCK) — sigmas for the Wan 2.2 high-noise and low-noise models, each with
its own step count, meeting at the boundary (
0.9for i2v,0.875for t2v). For one model, use the core ModelSamplingSD3 and BasicScheduler (simple): that is the same flow-match schedule. - Gilbert Encrypt / Gilbert Decrypt — scramble an image's pixels along a space-filling curve and restore it exactly with the same offset.
License and credits
MIT; see LICENSE. Code adapted from other projects is credited in THIRD_PARTY_NOTICES.md:
- Grow / Enhance Mask is adapted from ComfyUI-KJNodes.
- Image Guided Mask Refine and Analyze Mask Threshold follow ideas from ComfyUI-Image-Filters and ComfyUI-AutoMask.
- The Gilbert curve follows HilbertCrypt_bbw.
- The save nodes reuse the encoders of ComfyUI's own save nodes. Save Video (PCK) was written as a faster alternative to Video Combine from ComfyUI-VideoHelperSuite.
For developers
Tests, the code layout and how to add tag categories are in DEVELOPMENT.md.