ComfyUI Node

LaterProcessNode

The node that stops your ID photo from being rejected for being 2MB

By AIFSH·Created 2 years ago·Updated 2 years ago· 192
LaterProcessNode
  • input_img
  • normal_params
  • IMAGE

HivisionNode gives you a beautiful, exact-size cutout and AddBackgroundNode gives it the right color. Neither one gets you through an online upload form, because the systems that take ID photos are picky about two numbers nobody in the graph was enforcing: file size and DPI. That's LaterProcessNode's entire job - the last mile between "looks right" and "will be accepted."

It sits at the end of the pack's canonical chain: HivisionNode → AddBackgroundNode → LaterProcessNode → HivisionLayOutNode. If you're submitting the digital photo, this is the node that makes the output upload-able.

How it works

Two passes, both driven by normal_params:

  • kb (default 300) - the target file size. The node re-encodes your image as JPEG in a quality loop: start at 95, drop by 5 each iteration until the bytes fit under the target, with a hard floor so it always terminates. If the result comes in under target, it pads the file to hit the size - a quirk, but a harmless one.
  • dpi (default 300) - after the size pass, the image is re-saved as PNG with the DPI value stamped into the metadata via PIL. That's what some systems check when they reject your otherwise-fine photo.

It's a lossy pass by construction - that's the whole mechanism. Put it at the very end of the chain, after the background and watermark, so it compresses the final deliverable rather than an intermediate.

Inputs and output

  • input_img - the finished photo, typically the output of AddBackgroundNode. Any 3-channel image works.
  • normal_params - same PARAMS bundle as everywhere in the pack; this node reads kb and dpi.
  • Output - one IMAGE, the file-size-and-DPI-shaped final image. Straight into a SaveImage (or a PreviewImage if you're iterating).

A small implementation note: the node writes a tmp.png in ComfyUI's working directory during processing and deletes it afterward. Harmless in practice, but if your ComfyUI directory is read-only you'll see a write error here that nothing else in the pack triggers.

Installing it

Part of the same pack, so install once. ComfyUI Manager (search "HivisionIDPhotos") or:

cd ComfyUI/custom_nodes
git clone https://github.com/AIFSH/HivisionIDPhotos-ComfyUI

Restart ComfyUI. Only the pack's shared dependencies apply - this node uses OpenCV and PIL, no models, no downloads, runs on CPU instantly.

Where people get confused

  • "Where's the file-size setting?" - it's not on this node, it's on the params node (ENHivisionParamsNode / ZHHivisionParamsNode) upstream, in the kb field. That's the design: one PARAMS bundle fans out to every stage, so the size you want applies at the compression step automatically.
  • Output looks slightly softer than the preview - that's the JPEG quality loop doing its job. Raise the kb target if you can afford a bigger file; don't be surprised the compression exists.
  • It does nothing when wired mid-chain - correct, it's a terminal node. If you preview its output and see no change, check that the image actually went through it last.

Like the rest of this pack it's untouched since September 2024, but the mechanism is a handful of OpenCV/PIL calls that don't care about ComfyUI versions. Low risk, genuinely useful for the exact thing most ID-photo workflows forget.

CategoryAIFSH_HivisionIDPhotos

Inputs (2)

NameTypeDefaultDescription
input_imgIMAGE
normal_paramsPARAMS

Outputs (1)

NameTypeDescription
IMAGEIMAGE