Nodes/Comfyui_PDuse/PD-bingxiangtie-blend-v1
ComfyUI Node

PD-bingxiangtie-blend-v1

Put a photo inside a fridge-magnet frame

By 7BEII·Created 2 years ago·Updated 15 days ago· 53
PD-bingxiangtie-blend-v1
  • front_image
  • front_mask
  • medium_image
  • background
  • image
front_scale1.00
medium_X0
medium_Y0
medium_scale1.00
interpolationlanczos

PD-bingxiangtie-blend-v1 (PDBingxiangtieBlendV1) is the most specific node in this pack, and "bingxiangtie" gives it away: 冰箱贴, fridge magnet. It composites a front layer (with its mask) onto a background, then places a second image - the "medium" - inside the front layer's opening. In plain terms: it's the "put my photo inside the magnet's frame" node. Product-mockup people will recognize the pattern immediately.

Why you'd reach for it

This is a compositing shortcut for a workflow that's otherwise a pile of hand-placed nodes. The use case the class is built for: you have a fridge-magnet render (or any framed mockup) - a decorative front with a cutout - plus a mask marking where the cutout is, and a separate photo you want showing through that cutout. The node does the geometry for you: it finds the front mask's inner window, sizes your photo to cover it, and composites the whole stack over a background.

How it works

Mechanically, it's a three-layer stack. The front_image is scaled by front_scale (0.01–1, default 1) and centered on a canvas; front_mask marks where the front is opaque, and the code finds the inner window of that mask (the hole). Your medium_image - the photo or card - is resized to fit that window, scaled further by medium_scale, offset by medium_X/medium_Y (both range −8192 to 8192), and composited behind the front layer. background fills whatever's behind everything, cover-resized to the canvas. interpolation (lanczos default, plus bicubic/bilinear/area/nearest-exact) controls resize quality.

So the geometry you'd otherwise hand-tune - how big the photo, where it sits relative to the mask's hole - is derived from the mask instead. The tradeoff: the front image and its mask must agree precisely, or the "hole" lands somewhere you don't expect.

The inputs that matter

  • front_image + front_mask - the framed layer and where it's opaque. The mask defines the hole.
  • medium_image - what shows through the hole. The actual content.
  • background - the backdrop behind everything.
  • front_scale, medium_X/medium_Y, medium_scale - the positioning/scale dials.
  • interpolation - resize quality; lanczos is the sensible default.

Installing

Part of the 7BEII/Comfyui_PDuse pack. ComfyUI Manager → search "Comfyui_PDuse" → install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/7BEII/Comfyui_PDuse
cd Comfyui_PDuse
pip install -r requirements.txt

Restart after. No models; it uses ComfyUI's own comfy.utils upscaling plus torch/numpy.

Gotchas

The mask is the contract. If front_mask is inverted or noisy, the computed inner window will be wrong and your photo will land off-center or spill outside the frame - validate the mask visually first. front_scale maxes at 1.0, so the front layer can only shrink, never upscale past its native size. And note this composites by mask-derived geometry, not by percentage positioning, so it's purpose-built for magnet-style frames - don't expect a general-purpose layer blender; that's the pack's ImageBlendV1 instead.

CategoryPDuse/Image

Inputs (9)

NameTypeDefaultDescription
front_imageIMAGE
front_maskMASK
medium_imageIMAGE
backgroundIMAGE
front_scaleFLOAT1.000.01–1
medium_XINT0-8192–8192
medium_YINT0-8192–8192
medium_scaleFLOAT1.000.01–10
interpolationCOMBOlanczos5 options: lanczos, bicubic, bilinear, area, nearest-exact

Outputs (1)

NameTypeDescription
imageIMAGE