Image Transform
Data-augmentation transforms without leaving the graph
- image
- IMAGE
Image Transform is the pack's one-shot data-augmentation rig. It takes an image and produces a batch of variations: slightly rotated, perspective-distorted, sometimes mirrored, brightness/contrast/saturation nudged. It's the kind of thing you reach for when you're preparing training data - the KB's LoRA notes hammer that dataset curation beats every knob, and part of curation is giving the trainer more than one angle of the same subject.
It sits next to a sibling node, Image Random Transform, that does the same job with all-random parameters. This one gives you explicit control: you set the ranges, and the node generates repeat candidate images per input, each one a deterministic pseudo-random transform within those bounds.
How it works
For each candidate, it seeds a private random number generator with seed + candidate_index, so the whole batch is reproducible from the seed input - same seed, same variations, every run. Then it applies, in order:
- rotation - a random angle drawn from
[-rotation, rotation]degrees - distortion - a perspective warp; the four image corners get nudged by up to
distortion × min(W,H) × 0.25pixels each, which sounds small but reads clearly at the edges - flip - whole repeat-groups get mirrored on alternating passes, so candidate 1 of group 2 is a flipped copy of candidate 1 of group 1
- color - brightness, contrast, and saturation each multiplied by
1.0 + value
It rotates with expand=True then resizes back to the original canvas, so your output batch keeps the exact input dimensions - no overflow, no black triangles. The result is a batch of original batch × repeat images.
Inputs and outputs
The ones you'll actually touch:
- image - the source IMAGE
- seed - INT, default 0. Determinism for the whole variation batch
- repeat - INT, 1–256, default 1. How many candidates per input image
- distortion - 0 to 1, default 0.1. Perspective-warp strength
- rotation - 0 to 180 degrees, default 1. Max random rotation in either direction
- brightness / contrast / saturation - each −1 to 1, default 0 (off)
The single output is IMAGE - the full variation batch, ready for a trainer, a batch sampler, or eyeballing in a Preview.
Installing it
Standard XJNodes install, same as every node in this pack. ComfyUI Manager → search "ComfyUI-XJNodes" → install → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/alexjx/ComfyUI-XJNodes
# restart ComfyUI
It's pure Pillow/numpy/torch under the hood, so no extra pip packages. Find it under XJNodes/image.
Where to be careful
The repeat input is the memory trap: a batch of 4 images with repeat 128 becomes 512 images in one shot, and that's a lot of VRAM for whatever node comes next. Start small and scale up. Also note the color adjustments are applied per-candidate, so at defaults they're off - the node will happily produce rotation/distortion-only variations if that's all you set. And since distortion is a perspective warp rather than a barrel-lens effect, don't expect it to simulate lens artifacts; it's an augmentation tool, not a Photoshop filter. If your downstream use is training, this is a convenient way to build a multi-view dataset without leaving ComfyUI, but keep the KB's rule in mind: it's a supplement to good source images, not a substitute for them.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| seed | INT | 00–18446744073709550000 | — |
| repeat | INT | 11–256 | — |
| distortion | FLOAT | 0.100–1 | — |
| rotation | FLOAT | 10–180 | — |
| brightness | FLOAT | 0.00-1–1 | — |
| contrast | FLOAT | 0.00-1–1 | — |
| saturation | FLOAT | 0.00-1–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |