Monday, October 27, 2014

Two new photoflow features: integration of G'MIC filters and free-hand drawing tool

The development branch of photoflow now contains two new features: integration of the G'MIC family of filters and tools, and a free-hand drawing tool that is particularly useful for creating custom layer masks, or for local dodging & burning.

In this post I will only give brief intro of both features. Detailed tutorials on both of them will follow in an (hopefully) near future...

In order to test the new features, you need to compile the development version of photoflow:
git clone -b develop
cd PhotoFlow/build
bash ./

G'MIC integration

Thanks to the great help from D. Tschumperle and J. Cupitt (developers of G'MIC and VIPS respectively) I've been able to introduce a flexible interface between photoflow and the amazing G'MIC image processing library. Once this part of code was up and running, it has been quite easy to start adding specific code for the different G'MIC filters, which can now be natively associated to layers and applied non-destructively as any other tool in photoflow.

The list of G'MIC filters currently implemented is shown in the left screenshot below... many of the noise reduction tools are already included, and the list of implemented filters is growing quite fast. A generic tool is also provided, where you can enter an arbitrary sequence of G'MIC commands and see their effect on the processed image in real-time (right screenshot).

Some time in the future, I also plan to include G'MIC inpainting tool... but this will require some changes in the low-level image processing pipeline, since the inpainting is not compatible with tile-based processing and cannot be applied in real-time.

Hand drawing tool

This tool allows to draw pixels by hand using the mouse (on a layer mask or on the image itself). The tool works like a pencil of circular shape, with a user-adjustable size and color. The background color can also be changed by the user. By default, the background is black and the pencil is white, which is the most usual choice for drawing inside a layer mask for local editing pourposes.

The most interesting aspect of the tool is that it behaves in a completely non-destructive way: the strokes are drawn "on-the-fly" when the pixels are requested, and therefore there is no direct memory storage of the drawn image. This means for example that you can add a hand drawing layer on top of a very large image, with a marginal increae of the memory used by the program. This will also allow in future to introduce other, more "exotic" features, like post-editing of the strokes parameters (pencil size, color, visibility, etc...).

The image below shows the hand drawing tool in action, while painting on a layer mask with a large pencil size:

The next image shows a second hand drawing layer, added on top of the previous one in "lighten" blend mode at 50% opacity. As you can see, this allows to create complex masks step-by-step, with full control on the opacity of each part of the mask. This somehow reminds the way masks where created in the wet darkroom era, where each part of the global mask was assigned a different exposure time... here the time is replaced by the opacity.

The final screenshot shows a gaussian blur applied to the combined layers, so that the local editing blends seamlessly with the rest of the image.