Sky Replacement
Turn a gray, washed-out sky into a clear blue day, a golden sunset or a starry night. A sky segmentation model finds the sky, a guided filter fits the edge to trees and rooftops, and color harmonization shifts the light in the rest of the photo so the new sky looks like it belongs. Everything runs on your device.
Last updated:
Use your own ONNX model
Load a sky or binary segmentation model (.onnx) from your computer. It must take one RGB image (NCHW, ImageNet normalization) and return one channel where high values mean sky.
How to use the Sky Replacement
- Add a photo with a dull or blown-out sky: drop it on the box, choose it or paste it with Ctrl+V. A sample lakeside photo is shown until you do.
- Click Detect sky with AI for the cleanest result. The first time, the model downloads once and is cached; Quick detection gives an instant result meanwhile.
- Pick a new sky from the presets or choose your own sky photo, then move it with Sky position and flip it if the light comes from the wrong side.
- Blend it in: set Color harmonization so the landscape takes on the new light, and fine-tune Mask adjust and Edge softness (check the Sky mask tab).
- Download the finished photo as PNG or JPG.
How the new sky is blended in
Every output pixel is a mix of the new sky and your original photo, weighted by the sky mask m (0 = foreground, 1 = sky):
output = m × new sky + (1 − m) × harmonized foreground
- Mask: the AI model (or Quick detection) produces a low-resolution sky probability. It is upscaled and passed through a guided filter, which uses the brightness of your photo as a guide so the mask edge snaps to real edges such as rooflines and tree crowns.
- Mask adjust and Edge softness turn that probability into the final weight with a smooth step: Mask adjust moves the threshold (more or less sky), softness sets how wide the transition is.
- Harmonization: the tool measures the average color of the old sky and of the new sky behind it, then multiplies the foreground's red, green and blue by matching gains (limited to a safe range) and nudges its exposure, so warm skies warm the scene and night skies darken it.
Choosing a sky that looks real
| Your photo | Good sky choice | Harmonization | Tip |
|---|---|---|---|
| Midday, hard shadows | Clear blue or fluffy clouds | 30-50% | Keep the sun on the same side as the shadows (use Flip) |
| Overcast, soft light | Fluffy clouds or storm | 50-70% | A dramatic storm sky suits flat light better than bright sun |
| Late afternoon, long shadows | Golden sunset or pink dusk | 60-80% | Move Sky position toward Horizon so the glow sits behind the scene |
| Dusk or blue hour | Pink dusk or starry night | 70-100% | Night skies need strong harmonization to darken the foreground |
| Real estate exterior | Clear blue or light clouds | 30-50% | Subtle beats dramatic for listings |
Tips for clean edges
- Use the Sky mask tab: blue shows what will be replaced. Look closely at tree crowns, wires and the horizon.
- If a hazy horizon is left out, move Mask adjust toward More sky by 5-10. If bright walls or water are replaced by mistake, move it toward Less sky.
- Water reflects the sky. After a big change (gray to sunset), a lake can look wrong; crop it out with the Image Cropper or pick a sky closer to the original.
- For hazy landscapes, run Dehaze Image first so the hills have contrast before the new sky goes in.
Frequently asked questions
How does AI sky replacement work?
A segmentation neural network looks at a 320 × 320 version of your photo and outputs, for every pixel, how likely it is to be sky. That rough mask is scaled up and refined with a guided filter that follows the edges in your full-size photo, so branches and rooftops stay sharp. The new sky is then blended in through the mask, and the foreground is color-matched to it.
What does color harmonization do?
A sunset sky over a scene lit by gray midday light looks fake. Harmonization compares the average color and brightness of the old sky with the new one, then shifts the white balance and exposure of the foreground in the same direction, plus a light tint of the sky color. At 0% the foreground is untouched; around 50-70% looks natural for most photos.
Is my photo uploaded to a server?
No. The sky model is downloaded to your browser and runs on your own device with ONNX Runtime Web (WebAssembly). Quick detection and all blending are plain JavaScript. Your photo never leaves your computer or phone.
What is the difference between AI detection and Quick detection?
Quick detection is a classic image-processing method: it looks for bright, smooth, sky-colored areas connected to the top edge of the photo. It is instant and works offline, but it can miss skies behind leaves or include white walls. The AI model has learned what skies look like, so it handles complex skylines, hazy horizons and tree gaps much better.
Why are there halos or leftover old sky around trees?
Fine branches are smaller than the model's mask resolution. Move Mask adjust toward More sky to replace more of the bright gaps, lower Edge softness for a crisper cut, or raise it to hide a visible seam. Very detailed trees against a white sky are the hardest case for any sky replacement tool.
Can I use my own sky photo?
Yes. Click Choose your own sky photo and pick any image of sky; it is scaled to cover the sky area and you can move it with Sky position. Shots taken with the camera pointed slightly upward and with the horizon at the bottom work best. Use your own photos or images you have the rights to.
Is it okay to replace the sky in real estate or travel photos?
Sky replacement is common in real estate and travel photography to show a property on a nicer day. Many listing platforms allow it as long as the property itself is not misrepresented; check your local rules, and do not use edited skies in photos meant as documentation or evidence.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.