A FLUX-Fill based framework that replaces portrait backgrounds with cinematic, Instagram-aesthetic scenes while preserving subject identity and lighting coherence.
InstaStudio takes a portrait photo with a removed background (RGBA PNG) and generates a new scene behind the subject using a LoRA-adapted FLUX Fill inpainting model. The system is trained on ~130K Instagram-style portrait-background pairs, learning to produce backgrounds that match the subject's lighting, color palette, and overall mood.
This is not a generic background removal or compositing tool. InstaStudio generates scene-aware backgrounds that feel like they were shot on location, from rooftop terraces at golden hour to marble hotel lobbies and cozy library interiors.
-
Scene-Aware Background Generation. Trained on curated INS-style portrait-background pairs, the model understands how backgrounds interact with subject lighting, shadows, and color temperature. Generated scenes feel photographically coherent rather than pasted.
-
Short and Long Prompt Support. The model accepts both concise scene descriptions ("A rooftop garden terrace at dusk with string lights") and detailed multi-sentence prompts describing materials, lighting, and atmosphere. Training uses a 50/50 mix of both styles for robustness.
-
Flexible Aspect Ratios. Automatically computes output dimensions from the input image: long edge fixed at 1024, short edge follows the original aspect ratio (rounded to multiples of 16 for FLUX compatibility). Works seamlessly with portrait, landscape, and square inputs.
-
Guidance Scale Control. Low guidance (scale ~1) produces softer, more natural backgrounds; high guidance (scale ~30) produces sharper, more prompt-faithful scenes. Both are useful depending on the creative goal.
Prompt: INS STYle, A rooftop garden terrace at dusk with warm string lights draped above low wooden seating. Potted plants and small shrubs line the edges, and a distant city skyline glows softly against a deep blue sky. Lanterns on the tables cast gentle amber pools of light. The overall mood is intimate and relaxed, with a metropolitan evening ambiance.
Prompt: INS STYle, A spacious marble hotel lobby with tall glass windows, brass accents, and soft natural daylight.
Prompt: INS STYle, A bright white photography studio with pale pink accent walls, soft overhead panel lights, and a light wooden floor.
Prompt: INS STYle, A dramatic performance stage with a single powerful spotlight beam cutting through darkness from above. The stage floor is dark polished wood reflecting the intense white light. Faint traces of atmospheric haze float through the beam, and the surrounding area fades into deep black shadow. The overall mood is theatrical, intense, and visually striking with strong light-dark contrast.
Prompt: INS STYle, A clean modern rooftop terrace at sunrise with transparent glass railings and pale concrete flooring. A distant city skyline of tall buildings is softened by early morning haze, and the sky transitions from warm peach near the horizon to cool blue above. The atmosphere feels fresh and spacious, with crisp dawn light casting long subtle shadows across the smooth surface.
Prompt: INS STYle, A tranquil lakeside scene in golden autumn with slender birch trees displaying bright yellow and orange foliage along the water's edge. Fallen leaves dot the grassy shore, and the calm lake reflects the surrounding colors and a soft blue sky with wispy clouds. Warm afternoon sunlight bathes the scene in amber tones, and distant rolling hills complete the horizon. The atmosphere is peaceful, warm, and richly colored.
conda create -n instastudio python=3.10 -y
conda activate instastudio
pip install -r requirements.txtpython inference.py \
--rgba_image path/to/portrait_no_bg.png \
--prompt "INS STYle, A warm library interior with wooden shelves, amber lamps, and a quiet reading atmosphere." \
--model_path path/to/FLUX.1-Fill-dev \
--lora_path path/to/instastudio-lora \
--output outputs/result.png \
--long_edge 1024 \
--guidance_scale 30 \
--steps 50 \
--seed 42The output dimensions are computed automatically: long edge = 1024, short edge follows the original aspect ratio (rounded to multiples of 16).
All prompts must be prefixed with INS STYle, to activate the LoRA's learned style distribution.
Need help writing scene prompts? Use prompt_helper.md. It provides an English system prompt that can be pasted into ChatGPT, Claude, Qwen, or another LLM to generate InstaStudio-ready short and long prompts from simple scene keywords.
Short prompt (recommended for most use cases):
INS STYle, A modern rooftop terrace at sunrise with glass railings and a distant city skyline.
Long prompt (for precise scene control):
INS STYle, A clean modern rooftop terrace at sunrise with transparent glass railings
and pale concrete flooring. A distant city skyline of tall buildings is softened by
early morning haze, and the sky transitions from warm peach near the horizon to cool
blue above. The atmosphere feels fresh and spacious, with crisp dawn light casting
long subtle shadows across the smooth surface.
Prompt guidelines:
- Describe only what the scene is, never what it isn't. Negative phrasing ("without X", "no Y") causes the model to generate the unwanted elements.
- Use concrete visual elements: materials, colors, lighting conditions, spatial details.
- Match the observational tone of real scene descriptions, as if describing what you see in a photograph.
| Model | Status |
|---|---|
| InstaStudio LoRA inference weights | ShineChen1024/InstaStudio |
| Training code | train/finetune-bg.py |
| InstaStudio training dataset | Coming soon |
InstaStudio fine-tunes a FLUX Fill transformer with LoRA (rank 32, alpha 64) on ~130K portrait-background pairs. Each training sample consists of:
- Original portrait image with the background intact (target).
- Background mask derived from a background-removal model, indicating the region to repaint.
- Scene caption describing the background, randomly sampled as either a short (~1 sentence) or detailed (~3-5 sentence) description with 50% probability each.
All captions are prefixed with INS STYle, as a style trigger token. Training uses the FLUX flow-matching objective with uniform timestep sampling.
The training entrypoint is provided at train/finetune-bg.py. It fine-tunes FLUX Fill with LoRA and supports exporting LoRA weights for inference.
+------------------------------------------+
| InstaStudio |
| FLUX-Fill LoRA Inpainting |
| |
Portrait (RGBA) --> | [ Subject Composite ] + [ BG Mask ] |
Scene Prompt --> | [ "INS STYle, ..." ] |
| |
| FLUX Fill Transformer (LoRA-adapted) |
| | |
| v |
| [ Complete Portrait with New Scene ] |--> Output
+------------------------------------------+
InstaStudio/
|-- inference.py # Single-image inference
|-- train/finetune-bg.py # FLUX Fill LoRA training script
|-- prompt_helper.md # Prompt-writing helper for LLMs
|-- assets/examples/ # Generated examples
|-- requirements.txt
|-- README.md
`-- LICENSE
If you find this work useful, please cite:
@article{instastudio2026,
title={InstaStudio: Instagram-Style Portrait Background Generation},
author={},
year={2026}
}This project builds upon FLUX Fill for masked image inpainting.











