Nodes/comfyui-auto-anime-prompts/πŸ“· Passport Resize
ComfyUI Node

πŸ“· Passport Resize

Crop and scale any image to an actual US passport photo size

By jluo-githubΒ·Created 7 months agoΒ·Updated 7 months agoΒ· 0
πŸ“· Passport Resize
  • image
  • image
  • info
β—„output_size2x2_inch_600dpiβ–Ί
β—„crop_modecenterβ–Ί

Passport Resize does exactly one thing, and it does it correctly: it takes whatever image you feed it and returns a square image at the exact pixel dimensions a US passport photo needs. No models, no prompts, no settings beyond a dropdown and a crop mode. It's the boring, necessary middle step of the passport pipeline in the comfyui-auto-anime-prompts pack.

The typical flow: edit a selfie with Qwen-Image-Edit using Passport Prompt, then run the result through this node to enforce the spec - because whatever an image editor does to your face, it will not guarantee a perfect 600Γ—600 square. Then Passport Tile lays it on a 4Γ—6 sheet for printing.

How it works

Straight from the source in nodes/passport_photo.py: it converts the ComfyUI image tensor to a PIL image, optionally crops to square, then resizes with LANCZOS - the highest-quality resampling PIL has. Three output sizes, set by output_size:

| mode | pixels | use | |------|--------|-----| | 2x2_inch_600dpi | 600Γ—600 | CVS/Walgreens print quality | | 2x2_inch_300dpi | 300Γ—300 | standard print | | digital_only | 800Γ—800 | high-res square, no print |

crop_mode is the input that actually matters:

  • center - crops the middle of a non-square image. Right call when the subject is already framed.
  • top - crops to square but keeps the top of the image. Right call for a portrait where the head is near the top.
  • none - no crop; the image is resized to square by distortion. Only sane if the input is already square.

Outputs & gotchas

You get the resized image plus an info string that tells you the input size, output size, and crop mode, and helpfully declares it "Ready for CVS/Walgreens printing."

One real caveat from the code: it only processes the first frame of the batch. The node does image[0].cpu().numpy() and ignores the rest - feed it a batch of four photos expecting four resized outputs and you'll get one. If you're processing a folder, loop the node per image.

Second caveat, which applies to the whole pack: it's a tiny, single-maintainer project (MIT, no dependencies beyond ComfyUI's bundled torch/numpy/Pillow), so there's no community lore to lean on - the source is short enough that you can just read it.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/jluo-github/comfyui-auto-anime-prompts

Then restart. Or search "Auto Anime Prompt" in ComfyUI Manager. No model downloads - the heavy model (Qwen-Image-Edit) is only needed if you use the prompt/editing half of the pipeline; this resize node works on any image from any source.

The verdict: it's a three-line utility with a dropdown, and that's the point. Passport specs are unforgiving, and having the correct pixel dimensions hard-coded beats trusting your memory of what 300 DPI means at 2 inches.

Categoryimage/passport

Inputs (3)

NameTypeDefaultDescription
imageIMAGEβ€”
output_sizeCOMBO2x2_inch_600dpi3 options: 2x2_inch_600dpi, 2x2_inch_300dpi, digital_only
crop_modeCOMBOcenter3 options: center, top, none

Outputs (2)

NameTypeDescription
imageIMAGEβ€”
infoSTRINGβ€”