Nodes/ComfyUI_PhotoDoodle/PhotoDoodle_Sampler
ComfyUI Node

PhotoDoodle_Sampler

The node that actually runs PhotoDoodle

By smthemex·Created about a year ago·Updated about a year ago· 93
PhotoDoodle_Sampler
  • model
  • images
  • clip
  • image
promptadd a halo and wings for the cat by sksmagiceffects
width512
height768
steps20
guidance_scale3.5
max_sequence_length512

PhotoDoodle_Sampler is where the pack actually does the thing the GitHub page shows: you feed it a photo, type "add a halo and wings for the cat by sksmagiceffects", and out comes the same cat now wearing wings and a glow - pose, background, and lighting otherwise intact. It's the payoff half of the two-node ComfyUI_PhotoDoodle pack, a port of the Show Lab's PhotoDoodle method (Learning Artistic Image Editing from Few-Shot Pairwise Data, arXiv 2502.14397). FLUX.1-dev is the engine; this node is the steering wheel.

The model comes from its sibling, PhotoDoodle_Loader, which builds the whole FLUX stack and fuses the LoRAs. The Sampler never touches checkpoints itself - you wire the Loader's model output into its model input and get on with it.

How it works

This is a FLUX.1-dev diffusion run with a twist. Instead of starting from pure noise, the node VAE-encodes your input photo into latents, creates a fresh noise latent at the target resolution, and concatenates the two along the sequence dimension. A mask keeps the photo's latents frozen while the noise half gets denoised, and a custom position encoding covers both halves so the transformer knows which tokens are your picture. Your photo rides along as a fixed conditioning stream rather than being "described in the prompt" - the same latent-concat family of trick as FLUX Kontext-style editing. What makes PhotoDoodle different is that the model was fine-tuned on before/after pairs, so the fused LoRA already knows what "doodle" means: you say what to add, it adds exactly that, anchored to the real photo.

One practical detail: your input image is resized to the width/height you set, so those two fields are the output resolution as well as the canvas the photo gets scaled onto.

The inputs that matter

  • model - the MODEL_PhotoDoodle from the Loader. Non-negotiable.
  • images - the photo(s) to edit, straight from a LoadImage. A whole batch works; the node processes each image in turn with a progress bar.
  • prompt - the instruction plus the trigger, e.g. add a halo and wings for the cat by sksmagiceffects. That by sks<something> suffix is the LoRA trigger word, and it has to match the effect LoRA the Loader fused (sksmagiceffects, sksmonstercalledlulu, skspaintingeffects, sksedgeeffect).
  • width / height - 256–4096, in steps of 64; defaults 512×768. Your input photo gets resized to these.
  • steps - 20 by default, and that's genuinely enough here.
  • guidance_scale - 3.5, classic FLUX territory.
  • max_sequence_length - 512, the standard T5 window for FLUX.
  • clip (optional) - only needed when the Loader was set up in unet + vae + ComfyUI T5 mode. Then wire in a DualCLIPLoader (t5xxl + clip_l) so the Sampler can build prompt embeddings itself. In the recommended single-file or repo setups, leave it unplugged.

The output, image (IMAGE), feeds a standard SaveImage (or PreviewImage).

Installing it

Same as the Loader - one pack, one install. ComfyUI Manager search ComfyUI_PhotoDoodle, or:

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

then restart. Models are the shared burden: a FLUX.1-dev checkpoint (single-file fp8 is the sweet spot for ~12G cards) plus pretrain.safetensors and the effect LoRAs from huggingface.co/nicolaus-huang/PhotoDoodle, dropped into models/loras.

Where people get burned

  • "No clip selected" - the Loader is in unet+vae mode, so it flagged that a CLIP is required. Wire one in, or switch the Loader to single-file/repo mode and leave it.
  • The effect doesn't appear. Nine times out of ten the by sks… trigger in your prompt doesn't match the LoRA you picked in the Loader. They have to agree.
  • OOM at high resolutions. This is a 12B model with an extra conditioning stream; crank width/height up and VRAM goes with it. Enable use_mmgp on the Loader or dial resolution back.
  • License. It inherits FLUX.1-dev's non-commercial license: fine to sell your outputs, not fine to host the weights for others.
CategoryPhotoDoodle

Inputs (9)

NameTypeDefaultDescription
modelMODEL_PhotoDoodle
imagesIMAGE
promptSTRINGadd a halo and wings for the cat by sksmagiceffects
widthINT512256–4096
heightINT768256–4096
stepsINT201–1024
guidance_scaleFLOAT3.50–10
max_sequence_lengthINT512128–512
clipoptCLIP

Outputs (1)

NameTypeDescription
imageIMAGE