Faking the looks of a miniature shot with its shallow depth of field is quite easy in raster image editors like GIMP, but sometimes you might want to do that step directly inside of darktable. While that is not as flexible and fast for single images when you have a complicated composition in your photo and need to work pixel perfect it can however save you a lot of time for simple scenes and when you have to apply the same editing steps to a big number of images, for example when doing a timelapse.
In order to pull off a convincing job the photo you are working with should have a fairly wide view, some objects of interest in the middle ground and not too many overlaps of objects with different distances from the camera. Ideal is a view from some high point on a relatively flat area.
I am going to use a not-quite ideal photo to show different techniques and where a tool like GIMP has benefits.
As we can see the image has something to focus on in a medium distance from the camera, a relatively flat ground, and the view isn’t too narrow either. However the sitting people are overlapping parts of the pavement that is much farther away from the camera which we have to deal with somehow.
In a first step I am fixing the exposure and adding quite some saturation to make it look more like an artificial miniature world.
Next I am enabling the lowpass module in the effects group, setting the blur radius to 15. In order to keep the man on the bench in focus I add a first bézier mask in the form of a rectangle with a falloff that is wider on the bottom to simulate a shallow depth of field. By default that would lead to a blurred region in the middle of the image with the rest untouched. That’s not exactly what I want, so I enable invert mask in the module settings.
Due to the aforementioned overlap of man and background I also have to mask him out, so I add a second bézier mask and try to trace around him, playing with the falloff size where I have to. With this image it’s possible to do that, even though it would have been easier in GIMP where layer masks allow working really precise. The resulting mask should exclude everything with the same distance from the camera and thus be in focus.
The result isn’t that bad if my sloppy work with masking out the guy is ignored. If you invest more time it could be done much better.
Since objects that are further away from the camera are blurred more I add a second instance of the lowpass module with a radius of 30. To mask out the center part I add two gradient masks. They can be dragged on the canvas, and the falloff can be changed with the mouse wheel – just as with other mask types.
For simpler scenes without overlapping or if less blurring is used this is a quick and copy&pasteable way of adding a miniature effect to image sequences. In this case it would be borderline as the man would probably be moving so a tracking mask would be needed, something darktable doesn’t support (yet). For static landscape scenes it’s a viable option though.
If you want to try it yourself you can download the raw file and the XMP of my result to play around with.
In case you didn’t notice: you can click on all the images to see them bigger.
Update: I replaced the final version with a less sloppy one. The raw+XMP package got updated.