PD:Image_and_Text
Image_and_Text: build the before/after comparison sheet in one node
- image1
- image2
- merged_image
PD:Image_and_Text (ImageBlendText) takes two images, puts them side by side, and stamps a text caption under each one - then hands you one merged image. It's a presentation node, built for exactly one job: before/after comparisons, "原图 vs 效果图" show-and-tell, A/B result sheets. The author's default labels say it all: text1 is "before", text2 is "after".
How it works
Two images in, one out. If the inputs aren't the same size, the node aspect-scales the second to match the first instead of erroring - a small mercy that keeps mismatched outputs from derailing the sheet. longer_size (128–2048, default 1024) caps the longest edge so your comparison doesn't balloon into a 4K monster. The two halves are joined horizontally and a caption band is appended under each, with padding_up and padding_down controlling the whitespace around the text - and padding_down goes all the way to 1000, so you can extend the canvas downward to give the layout room to breathe.
Text is drawn with a TrueType font from the pack's fonts/ folder (font_file, default Oswald-Bold.ttf), at font_size (10–100, default 90). text_style picks dark or white text.
The inputs that matter
image1/image2- the pair. Order defines left/right and which label lands under which.text1/text2- the captions. Supports Chinese, but only if the chosen font covers it (see below).font_file- pick a font that actually renders your text. The shipped list includes CJK faces like Source Han Sans and Alibaba PuHuiTi for a reason.longer_size- the one dial to set if you want uniform output size across a batch.
Output is merged_image, one IMAGE tensor, straight into Save Image.
Installing
This is a node in the 7BEII/Comfyui_PDuse pack. ComfyUI Manager → search "Comfyui_PDuse" → Install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/7BEII/Comfyui_PDuse
cd Comfyui_PDuse
pip install -r requirements.txt
No model downloads. Dependencies are the pack's light Pillow/numpy/opencv set plus torch from ComfyUI.
Where people get burned
Fonts, again - this pack is a font-dependent bunch. The author's own notes warn that font_size under 20 becomes unreadable and above 90 can overflow the canvas; treat 30–80 as the working range. The bigger trap is Chinese text on a Latin font: it renders as tofu boxes. The shipped CJK fonts exist exactly for this; swap font_file to one of those (HYQiHei, Source Han Sans, Alibaba PuHuiTi) before you blame the node. And don't expect this to composite labels over the image - it's a caption strip underneath, which is the right call for comparisons anyway.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| image1 | IMAGE | — | |
| image2 | IMAGE | — | |
| text1 | STRING | before | — |
| text2 | STRING | after | — |
| longer_size | INT | 1024128–2048 | — |
| font_size | INT | 9010–100 | — |
| padding_up | INT | 100–100 | — |
| padding_down | INT | 200–1000 | — |
| font_file | COMBO | Oswald-Bold.ttf | 9 options: Oswald-Bold.ttf, Caveat-VariableFont_wght.ttf, HYQiHei-105JF.otf, Alibaba-PuHuiTi-Heavy.ttf, SOURCEHANSANSCN-MEDIUM.OTF, sign_Caveat-VariableFont_wght.ttf, +3 |
| text_style | COMBO | dark | 2 options: dark, white |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| merged_image | IMAGE | — |