[highlight]Animated Brushes[/highlight]
This tutorial is a work in progress, this is the reason for its presence in the General Help section. Help with explaining the various options would be very welcome, don't hesitate to participate if you can or spot a mistake. It is also an advanced topic that requires you knowing more than GIMP's basics, so the tutorial may be hard to follow for beginners. This guide was written based on observations with version 2.2.14 for Windows.
The first thing you should read is the manual. The section “The GIH dialog box” deals with all the options that you have when creating animated brushes. Hopefully, the manual will improve in that regards, but before this happens, here are a few more tips and instructions.
To create an animated brush, start with a new file of the needed dimensions and save it right away in XCF format. Animated brushes can take the colours picked by you if you save the file as a grayscale image, or have the same colours you used to create your brush if you save them as an RGB image, so take your pick now. If you create a greyscale image, it seems you have to make your brush's background
white and not transparent. The white will be interpreted as the transparent colour and black will be the picked colour at full opacity when you use your new brush. In the case of coloured brushes (such as the Pepper brush that comes with GIMP's default brushes), transparency is transparent.
[highlight]Random Brush[/highlight]
A good example of a random brush would be confetti. GIMP already comes with an animated brush called confetti, but we'll create our own.
First, decide how many different confetti you need. Let's say you're happy with 10 different shapes. Start by creating the first shape in a new layer, “First shape”.
Next, you have few choices: you can create the subsequent layers as new empty layers in which you draw again a new shape or you can duplicate and transform the first shape (rotate, scale, shear, perspective). Depending on the subject of your brush (in our case confetti paper bits), it may be faster to hand draw them if you'll just use small lines like the GIMP's confetti brush, but for more complicated shapes, duplicating and transforming may be better.
Once you have your 10 layers, save your work in the XCF format then save a copy in GIH format. You can save it in your brushes directory directly if you want to preview it in another file.
The GIH dialogue box comes up after you have specified the name of the file.
The spacing is how often the brush will repeat. I put mine to 1000 just to test this new brush. The description is what appears in the brushes dialogue; you can use the same name as the file to make it less confusing.
The cell size has interesting properties, but we'll go back to them later. For now, change the dimensions to reflect your image size.
Number of cells will reflect the layers that can be used, starting from the
top of the list, so you can use only 5 of the 10 created layers if you wanted. The first cell will also be used to create the preview for the brush, the image that appears in the Brushes dialogue. The size of the first cell is what influences the the spacing, for example, if your first cell is 100x100, the second is 300x300 and the spacing is 150, the space in between the two shapes will be 150 pixels (that's the length of the line you draw using this brush, so if you circle in place for 150 pixels, the shapes will overlap, as expected).
The “Display as” information will be revisited a bit later.
Dimension determine the number of different effects you can create with the brush, maximum of 4.
Ranks has to reflect how many cells are to be used by the Random effect in our case. You need to make this number equal to the number of cells for the new confetti brush, but if you want, you can further reduce the number to say, 3 cells used randomly, which leaves 2 more to play with another effect (dimension).
Once you press OK, the file will actually be saved. Don't forget to press the “Refresh” button in your Brushes dialogue so you can start using it.
The same brush could be done in a different way: create a new image,
test.xcf, of 150x60 pixels and “Add Alpha Channel” to the Background layer. Using the “Show Grid” option from “View” menu, imagine the file is split in 2 vertically and 5 horizontally:
Now save it as a .GIH file and watch the GIH dialogue:
You can see I modified the cell size to read 30x30; this has created a table of 2 rows and 5 columns, as indicated in the “Display as” information. The number of cells is still 2 * 5 = 10, out of which I am going to use 10 cells to create my random effect. This way of creating your cells can come in handy later on when dealing with multiple ranks, when having tens of layers would get messy really fast.
The cells are numbered from left to right and top to bottom, so the first cell is “a”, the second is “b”, the fifth is “e” and the sixth is “f”.
[highlight]Incremental Brush[/highlight]
To create an incremental brush, you would follow the same steps as above, except selecting an “Incremental” rank, obviously. The peculiar thing is that, the first time you use the brush, the count starts from the second cell instead of the first cell, as would be logical. If you interrupt the stroke when you reach cell 5, for example, the next stroke you do with this brush (even if you change tools or brushes in between) starts with the cell 6.
[highlight]Angular Brush[/highlight]
The manual says the first cell in use is the 0 degrees angle (from middle of the image to top-middle of the image) and the others just follow the formula 360 / number_of_angular_ranks. That's not entirely true, at least not in Windows (I have read about this being a bug in Windows, if someone using Linux can confirm it works properly for them, I'll update this). It seems to be more like 15 degrees (from middle of the image toward top-right). The last cell is used for the 345 degrees angle (from middle toward top-left)
and 0 degrees.
Let's try to create a brush that has an arrow in the direction of your stroke and it changes based on the angle you draw at. If using few cells for this, you would end up having a pretty ugly, choppy result. The finest brush would have 360 (is that possible?) cells, but who's crazy to do that many? Besides, the computer resources used by such a brush would probably require way too many computer resources.
So I'll test with 24 cells, which should give me a smooth-ish (360 / 24 = 15 degrees angle for each cell) brush.
First, let's start with a layer of 15x15 in a 90x60 image. Inside the little layer, I will draw my brush, an arrow.
If I knew how to code filters/scripts for GIMP, the next steps would be very easy! If you can, please help!
Once I have my first arrow, going from the bottom middle of the layer to top middle of the layer, I move it into position 1. It would be so much easier to perform the next steps through code: duplicate this first layer 5 times into position 2 through 6, and rotate it by current rotation + 15 degrees for each layer (so cell 2 = 15 degrees, cell 3 = 30 degrees, etc.). Once you have the 6 layers, you duplicate layer 2 through 6 in reverse position from 8 to 12, flipping each layer vertically: cell 2 becomes cell 12, cell 3 becomes 11, etc.
We're almost there!
For cell 13, you need to duplicate cell 24 and flip it vertically. Duplicate cell 2 through 12, flipping them horizontally, into cell 24 through 14: cell 2 becomes cell 24, cell 3 becomes cell 23, cell 7 becomes cell 19, cell 12 becomes cell 14.
That's it! Save your XCF so you can come back and modify if needed, then flatten the image, add an Alpha channel to the Background layer and save as GIH. Choose the 24 ranks to be angular and a spacing of 50 if you want to test it properly.
As I said, on my Windows computer, the angle 0 (first cell) rarely appears and I have no idea what exactly influences it (not even holding down Ctrl+Shift helps); instead, the cell 24 (angle 345) appears when drawing perfectly vertical lines. But the rest of the angles appear correctly and I'm quite happy with the (albeit ugly-looking) brush. Since I don't think many people will have the patience to do this, I'm uploading the resulting brush, called “Test Angular” for those Linux people to tell me if it works better on their machines.