For visit and open days, I wanted to retouch photos of visitors to create a memorable image with a fake background. The department bought a (cheap) green screen which could also be useful for other purposes. The choice of editing tool was GIMP, as I tend to harness free software.
However, quickly I found that the first test with suboptimal lighting and the material of the green screen leads to suboptimal results or many manual steps are needed. Since many visitors are expected and as a computer scientist I aim to automatize repetitive tasks, a lengthy manual editing to filter the background was not up for debate.
Luckily GIMP supports scripting via Python. A search in Google, however, did not reveal any useful Plugin. Therefore, I decided to write a script to remove the green screen and others to actually fill the fake photos nearly automatically.
As I had not used GIMP scripting before, I had to look up some tutorials. Since GIMP is developed many years there is quite some outdated documentation. The most helpful documentation was PDB, which provides a wrapper for the C-Functions of GIMP.
I found the final result useful and sufficiently accurate for our green screen. You can download it here: GreenScreen.py
An example of a fake image created. It takes now about 30 seconds to produce such an image.