Nodes/ComfyUI-Apt_Preset/Image_transform_layer
ComfyUI Node

Image_transform_layer

Composite one image onto another, Photoshop-style

By cardenluo·Created 2 years ago·Updated 18 days ago· 309
Image_transform_layer
  • bj_img
  • fj_img
  • mask
  • composite
  • mask
  • bg_fill
coordinates[{"index":1,"x":0.5,"y":0.5}]
coordinate_aligncenter
bg_fillblack
x_offset0
y_offset0
rotation0.0
scale1.00
opacity1.00
blending_mode正常
blend_strength1.00

This is a layer compositor - take a foreground image, place it on a background image at a position, rotation and scale you set, blend it in with a real blend mode, and get the composite back. If you've ever built a two-layer edit in Photoshop (move the layer, rotate it, pick Multiply or Screen, adjust opacity), this node is that operation as a ComfyUI graph node. It's the one to reach for when you need precise, numeric control over where a foreground element sits - a logo, a cutout subject, a texture - rather than eyeballing coordinates.

How it works

bj_img is the background, fj_img is the foreground going on top of it. Position is set two ways at once: coordinates is a JSON string listing placement points (the default, [{"index":1,"x":0.5,"y":0.5}], places the foreground centered - x/y are normalized 0–1 fractions of the canvas), and coordinate_align decides which part of the foreground that point refers to - one of nine anchor positions (top-left through bottom-right, center). x_offset/y_offset then nudge the result in raw pixels on top of that. rotation (degrees) and scale handle orientation and size. For the actual blending, blending_mode gives you the full Photoshop blend-mode list - Normal, Multiply, Screen, Overlay, Darken, Lighten, Color Dodge, Color Burn, Difference, and the rest of the 27-item set - shipped with Chinese labels in the dropdown (正常 = Normal is the default), because this is a Chinese-authored pack. blend_strength controls how strongly that blend mode applies, separate from opacity, which controls the layer's overall transparency regardless of blend mode.

The inputs and outputs that matter

  • bj_img / fj_img (required) - background and foreground.
  • coordinates (STRING, multiline, JSON) - placement point(s) as normalized fractions of the canvas.
  • coordinate_align - which point on the foreground the coordinate refers to (9-point anchor grid).
  • x_offset / y_offset (INT, ±10000) - pixel nudge on top of the coordinate.
  • rotation (FLOAT, ±360, default 0) - degrees.
  • scale (FLOAT, 0.1–5, default 1) - foreground scale.
  • opacity (FLOAT, 0–1, default 1) - overall layer transparency.
  • blending_mode - the Photoshop-style blend list, default Normal (正常).
  • blend_strength (FLOAT, 0–1, default 1) - how strongly the blend mode itself applies.
  • bg_fill - a fallback color for any canvas area not covered by either image.
  • Optional mask - constrain where the foreground composites onto the background.

Three outputs: composite (the finished image), mask (the composited region as a mask, for reuse downstream), and bg_fill (an image showing just the fill layer, useful for debugging placement).

How to install it

ComfyUI Manager: search ComfyUI-Apt_Preset, install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset
pip install -r requirements.txt

install.bat is Windows-only; on Linux (comfy.icu's executor included) run pip install -r requirements.txt directly. No model downloads needed - this is pixel compositing, not generation.

Common issues

The coordinates field is the one that trips people up - it's a hand-typed JSON string, not a set of number widgets, and a malformed entry (missing a comma, wrong key name) will fail silently or default rather than throwing an obvious UI error. If your foreground isn't landing where you expect, copy the default string exactly and edit only the x/y values first before changing anything else about its structure. If you'd rather not hand-edit JSON at all, this pack ships Image_transform_layer_visual, which replaces the JSON coordinates with an interactive on-canvas widget - worth switching to if precise typed coordinates aren't a requirement for your workflow.

The blend-mode dropdown showing Chinese text is expected, not broken - it's the literal enum value the author shipped, not a localization bug in ComfyUI itself. And as with every node in this pack, a from-scratch install pulls a large requirements.txt (onnxruntime, gguf, transparent-background, and more, for the pack's other 100+ nodes) - there's a documented case of that failing to import on a fresh setup. If the whole pack throws IMPORT FAILED, check the ComfyUI console for the specific missing package rather than assuming this node caused it.

CategoryApt_Preset/image/ImgLayer

Inputs (13)

NameTypeDefaultDescription
bj_imgIMAGE
fj_imgIMAGE
coordinatesSTRING[{"index":1,"x":0.5,"y":0.5}]
coordinate_alignCOMBOcenter9 options: top_left, top_center, top_right, left_center, center, right_center, +3
bg_fillCOMBOblack9 options: black, white, red, green, blue, yellow, +3
x_offsetINT0-10000–10000
y_offsetINT0-10000–10000
rotationFLOAT0.0-360–360
scaleFLOAT1.000.1–5
opacityFLOAT1.000–1
blending_modeCOMBO正常27 options: 正常, 溶解, 变暗, 正片叠底, 颜色加深, 线性加深, +21
blend_strengthFLOAT1.000–1
maskoptMASK

Outputs (3)

NameTypeDescription
compositeIMAGE
maskMASK
bg_fillIMAGE