Gimp - mastering filters

From LXF Wiki


(originally published in LinuxFormat No.64)

Gimp has done well to offer a range of filters... but does anyone know what they're for? Michael J Hammel demystifies Noisify, Cubism and Wind with a quick 3D cityscape project.

Table of contents

Mastering Gimp filters

Gimp offers a plethora of built-in tools: brushes, patterns, selections, colour management... the list is impressive. On top of these are a wealth of filters (also known as plug-ins) for automating tasks and generating imagery. Together these features make Gimp a powerful image editing program.

With so many options, the problem for new users is learning where these tools are and what they do. And once they find their way around the program, the problem becomes when and why to use which features for any given project.

This month's tutorial on creating an imaginary 3D cityscape of high-rise buildings uses three of Gimp's filters ­ Noisify, Cubism and Wind. We'll explain how they work and why we chose them for this project.

Screenshots for this article are taken from Gimp 2.0 but the process is applicable to Gimp1.2 as well as the recently released Gimp 2.2.

Before the tutorial begins, let's take a look at the three filters that we'll be using.

The Noisify filter

An often overlooked filter, Noisify simply adds coloured pixels at evenly-distributed locations around the canvas at random.

Evenly distributed means that the noise should not have clumps of pixels scattered around the canvas. However, random means that if you ran the Noisify filter twice using the same settings the rendered effect would appear different.

As an example of what noise looks like, turn on your TV set to a broadcast (not cable) channel that has no signal. See the dots flying all over? That's noise. Noisify (located in the Gimp menu at Filters > Noise > Noisify) adds something like this to a canvas. You dictate the amount of noise; from a few soft specks that look like snowflakes at a distance to densely-packed dots that resemble your TV screen in the middle of a storm.

Adding noise is a common way to begin an effect for many images. It can provide texture for a solid colour, thereby producing walls, cement, gravel and a variety of other surfaces. Noise can also break up streaks of colour in gradients and add age to a photograph. You could even use noise generated with the same settings across multiple frames of an animation to simulate `snow' in a TV signal.

Noisify requires no image content on the layer to which it is applied. You can apply noise to a completely empty layer (that is, fully transparent) or you can apply it over a layer that is fully opaque. When the noise itself will provide the final effect ­ such as snow or rain falling ­ it's often best to place the noise on its own layer. If the noise is to be used as the first part of a multi-step process to create an effect ­ as with our cityscape tutorial ­ the noise is often placed on an existing layer that already has image content. If the layer is not empty then the noise will replace image content in that layer.

Each colour channel in a layer can have different levels of noise configured. The channels can be set to unique values or set so that they all have the same value. If the Independent toggle is unset the resulting noise will be desaturated (ie white, grey or black). If that toggle is set, though, the noise will have a variety of coloured pixels.

The Cityscape tutorial will use noise to add a limited amount of grey to a black layer in order to give the Cubism filter (more of which follows) some image variation from which to create random, semi-transparent squares. Without the noise, the solid black colour would not provide Cubism with enough pixel information to produce the shapes we need for this project.

The Cubism filter

The Cubism filter (Filters > Artistic > Cubism) generates a collection of semi-transparent squares similar to bits of translucent paper. Imagine cutting a bunch of rectangles out of rice or tissue paper, putting the rectangles in a box then flipping the box over to let the pieces float to the ground. The mess on the floor is what Cubism is designed to reproduce.

While Noisify renders image content without regard for existing content, Cubism relies on the original image content to produce its effect. If the image content for a layer is a solid colour the results of running Cubism on that layer would be the same solid colour (ie no different). Adding noise to the solid colour provides enough variation to the image content for Cubism to produce visible changes. In fact, that is exactly how Cubism will be used in the Cityscape tutorial.

Cubism provides only two options ­ the size of the squares and tile saturation. The true size of the squares is set by a combination of larger sizes and higher saturation levels. Higher saturation levels also reduce the number of squares generated. Think of saturation as being like a zoom setting ­ higher saturation means getting your head closer to the floor to view the bits of rice paper, making the squares appear larger.

The choice of Cubism is key to the Cityscape tutorial. The shapes it produces will become the roofs of buildings as well as the surfaces from which we will extend the sides of the buildings using the Wind filter. Without the effect produced by Cubism, the Cityscape would be considerably harder to create.

Missing image
The Jackson Pollock of filters, Noise sprays pixels on to a canvas. It's even, so you won't get clumps.
Missing image
Cubism scatters semitransparent squares around the image ­ but only if there is at least some colour variation already here. This example was created by using the Small Squares pattern to fill the canvas, then applying the Cubism filter.
Missing image
Wind blows white or black. In our project, `Leading Edge' wind will be used to extend walls from the Cubism roofs.

The Wind filter

New users to Gimp tend to see a filter and assume a single purpose. The Wind filter, for example, is expected to produce images that look like blowing sand or snow. It is, after all, called Wind. It implies adding motion to an image.

The truth is that most filters can be used in ways not implied by their names. The Wind filter (Filters > Distorts > Wind) works by extending black and white lines out away from what it perceives to be an edge in an image. These lines are effectively the same as a motion blur, though with variations provided by the Wind filter's options. The main drawback to using Wind for motion blur is that it only works horizontally (in two dimensions, the wind can only blow from the left or the right)Motion Blur filter, on other hand,the wind can the other hand, can be set to any angle.

But the Cityscape tutorial doesn't need a motion effect. The Wind filter provides walls to go with the roofs created by Cubism. This tutorial will use Wind to extend walls from the edges of the squares generated by Cubism. We will literally blow the walls out from the roofs.

The Wind filter has three main settings: Style, Direction and Edge Affected. Style gives two options: Blast, which gives an explosion-like effect; and (confusingly) Wind, which gives a softer look. Direction defines where the wind blows from. Edge Affected is a bit of a misnomer. Leading will produce a white wind while Trailing will produce a black wind. Strength and Threshold options are also available with the Wind Filter.

The filter's Strength is, essentially, the length of the path of blowing wind. A low Strength setting gives a gentle zephyr, while a higher value means bracing gusts, and a more dramatic effect in the image.

Most filters or tools in Gimp that offer a threshold option (such as Wind, Select by Colour or Fuzzy Select) enable you to specify how an edge is defined. High threshold values mean that adjacent pixels can be further apart in value (eg colour, brightness) before they would be considered an edge. Lower values mean that only pixels that are near in value are likely to be be considered an edge. A low threshold value on a scenic photograph might produce large numbers of edges. A high threshold value would reduce that number.

This works for us because Wind only works horizontally, and Cubism produces defined edges. So no matter what the angle of the roof, the walls can be extended all in the same direction. All that's needed after Wind creates the walls is to rotate the layer 90 degrees to make the buildings stand upright.

Missing image
1/ Now that the filters are less of a mystery, the real work for this project can begin. Start with a 480 x 640 canvas et at 250 DPI, and fill the new image with black. This will produce a small printable image that is about 2.5 inches by 1.9 inches. You can reproduce this tutorial later at a larger size. Note that prints set for typical paper sizes require a fair amount of memory. The US Legal size takes up 23MB just sitting there. Add some undo levels and multiple layers and the memory requirements can add up fast for print images. Images destined for the web are usually created at 72 DPI, which greatly reduces the project's memory needs.
Missing image
2/ Create a rectangular selection through the middle half of the canvas. Copy and paste this as a new layer. Fill the new layer with noise using the Noisify filter (Filters > Noise > Noisify). Unset the Independent toggle button. Set all three of the Red, Green, and Blue sliders to 0.82.
Missing image
3/ With the noisified layer active, open the Cubism filter (Filters > Artistic > Cubism). Set the Tile Size to 35 and the Saturation to 2.7, then apply the filter to the noise layer. Change the layer size to equal the full canvas (Layer > Layer to image size). Add a new, empty layer and fill with a black to transparent gradient, starting from the top. The gradient should flow just till it starts to fade out the squares generated by the Cubism filter. With the gradient layer active, merge the gradient layer with the Cubism layer (Layer > Merge Down).
Missing image
4/ Rotate the Cubism layer 90 degrees clockwise (Layer > Transform > Rotate 90 degrees CW). Open the Wind filter (Filters > Distorts > Wind). Set the Style to Wind, Direction to Right, and Edge Affected to Leading. Then set the Threshold to 2 and Strength to 50. Apply the filter. Repeat (Ctrl+F) two or three times, until there is little or no change with additional applications of the Wind filter. This process is how we blow the walls out from the roofs for our buildings. Rotate the layer 90 degrees counterclockwise to make the buildings stand vertically.
Missing image
5/ At this point the image is essentially done. Only clean-up and detailing are left to do, which are not strictly required but do serve to enhance the final effect.
Missing image
6/ Open the Gaussian Blur RLE dialog (Filters > Blur > Gaussian Blur RLE) and blur the buildings layer lightly, 2x2 for his size image or more for larger versions. Use the Scale Transform Tool to drag the bottom half of this layer down until the bottom edges of the buildings touch the bottom of the Canvas window. This stretches the buildings. If the detail provided by the Unsharp Mask is lost after scaling, try duplicating the layer and set the duplicate layers opacity to a low amount and its blend mode to Addition. Now merge the two layers and reapply the Unsharp Mask.
Missing image
7/ Additional depth and detail can be achieved by bump mapping the cubism layer. Open the Bump Map filter (Filters > Map > Bump Map). The Map Type can be chosen by previewing each and choosing the most appropriate type. Enable the Compensate for Darkening toggle button. Be sure the Bump Map selected is the same layer as the Cubism layer and adjust the Azimuth, Elevation and Depth to produce a preview that looks best. Leave all other settings at their defaults.

Final tips

This project could be used to produce a poster or flyer by simply adding some text. Be sure to add the text where there is enough contrast to easily read the words ­ placing them over the solid black background would be best.

For larger versions of this project, such as those intended for print, repeated scaling, blurring, and application of the Unsharp Mask may be needed to achieve the desired effect.

The settings for Unsharp Mask will be affected by the results of the Cubism filter, which will be different for everyone who tries this tutorial. This is due to the random nature of the original noise and the variation produced by the Cubism filter. LXF