gitmyhub

IC-Light

Python ★ 8.4k updated 1y ago

More relighting!

IC-Light is an AI tool that changes the lighting in photos. You describe the lighting you want in text, or supply a background image, and it relights your subject to match.

PythonPyTorchHuggingFaceGradiocondasetup: moderatecomplexity 3/5

IC-Light is a Python project that changes the lighting in photos using AI. The name stands for "Imposing Consistent Light," which refers to the technique it uses to keep lighting changes believable and physically coherent across an image.

The project offers two modes. In the first mode, you describe the lighting you want in plain text, such as "sunshine from window" or "neon light, city," and the model adjusts the image to match that description. In the second mode, you provide a background image, and the tool figures out how that background's lighting would fall on your subject. Both modes take a foreground image, like a person or object, and produce a relit version.

Setting it up requires cloning the repository, creating a Python environment with conda, installing a handful of packages, and running a Python script that opens a browser-based demo. The models download themselves automatically when you first run the demo. There is also an official demo hosted on HuggingFace Spaces if you want to try it without installing anything locally.

Under the hood, the project applies a mathematical property of light: different light sources can be blended together, and their combined effect on a scene matches what you would get if all those light sources were present at once. The team built this consistency into the training of the AI models, which means the relighting results are coherent enough that you can even extract surface normal maps from them, something the models were not explicitly trained to do.

This is a research release aimed at people who want to experiment with AI-driven image relighting. It is not a polished commercial product. The repository notes clearly that a third-party website using a similar name is unaffiliated and should not be trusted.

Where it fits