Instructions to use thedeoxen/refcontrol-flux-kontext-reference-canny-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use thedeoxen/refcontrol-flux-kontext-reference-canny-lora with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("thedeoxen/refcontrol-flux-kontext-reference-canny-lora") prompt = "Turn this cat into a dog" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
metadata
tags:
- text-to-image
- lora
- diffusers
- template:diffusion-lora
base_model: black-forest-labs/FLUX.1-Kontext-dev
instance_prompt: null
license: apache-2.0
pipeline_tag: image-to-image
RefControl Flux Kontext β Reference Canny LoRA
π Short description
A LoRA for Flux Kontext Dev that fuses a reference image (left) with a canny edge map (right).
It preserves identity and style from the reference while following the edges and outlines from the control.
Trigger word: refcontrolcanny
π Examples
π Extended description
This LoRA was primarily trained on humans and characters, but it works with objects and scenes as well.
The main purpose is to preserve identity β facial features, clothing, style β from the reference image, while using the canny edge map to define contours, composition, and layout.
βοΈ How to use
- Concatenate two images side by side:
- Left: reference image (person, character, or object).
- Right: canny edges (line structure).
- Add the trigger word
refcontrolcannyin your prompt. - Adjust LoRA weight (recommended 0.8β1.0) depending on how strictly you want to follow edges.
β Example prompt
refcontrolcanny, change canny edges to photo with reference from left
π― What it does
- Preserves style and identity of the reference.
- Uses canny edges to control structure, outline, and composition.
- Produces consistent results across different poses and layouts.
β‘ Tips
- Works best if the canny map captures clean edges with minimal noise.
π Use cases
- Character consistency in illustrations and comics.
- Stylized redraws of objects with sharp outlines.
- Scene composition based on silhouettes.
- Rapid prototyping of layouts and storyboards.





