Thursday, November 11, 2010

Swirls and Spirals in GIMP

This blog has most of its traffic coming from image searches. There also happens to be few images that turn up of plain spirals when googling such a thing. So, in a shameless bid to drive more traffic, I'm going to do a short lesson on making spirals in GIMP, complete with images that are free to reuse for non-commercial purposes. There are a number of different ways to do different spirals, this is just one way that works.

1. To create a basic two tone spiral, begin by dividing the canvas in the colors desired; note it doesn't really matter how you divide the canvas, so I'm going with the second (or third) most obvious way.

2. If you want to swirl around a very specific point, such as the center of the image, it will help to paint a smallish, visible dot at this point (using guides and the snap-to-guide option might help). If you get the right size dot and do enough swirling, you don't even need to do any touch up as the dot gets swirled into the infinite beyond.

3. Be sure to select all, then use the IWarp filter (filters>distorts>IWarp), with the deform mode as either swirl CCW or swirl CW. Instead of clicking and dragging as suggested, just click repeatedly on the same spot. I prefer to do less clicking, so I set the deform amount to the maximum; you will have to experiment with the deform radius to get the result you desire. The result will look something like this:

4. If you'd rather not have a square border around the roundness, use the ellipse select, invert selection, and delete/fill/whatev. You have a true circle when the sizes in the ellipse select tool options are equal. Note that blogger is replacing transparency with black. Result:

The following process for a spiral with more than two tones can also be used for two tone, in fact if you want to end up with a circular boundary this way is probably easier.

1.Start by dividing the image into your colors.

2. Next, use filters>distorts>polar coordinates to come up with exactly the multicolored circle you need. While doing so you can abandon any preconceptions about the separation between mathematics and art, as this filter is using the Pythagorean theorem and inverse sine function (aka arcsin) to convert the image from the rectangular Cartesian coordinate system to the circular system of polar coordinates. In rectangular coordinates, a position is denoted by horizontal and vertical displacements from the center (aka origin); in polar coordinates a position is denoted by its distance from the origin and amount of rotation away from whatever is considered 0 degrees/radians. If you didn't know about all this polar coordinate business, consider how much more useful GIMP is going to be now that you do, and how generally richer life will be from now on.

3. The same as step 3 above, filters>distorts>IWarp, swirl, and click away. There will be a tiny bit of deviation from perfectly circular, this can be helped either by fine tuning the IWarp settings, by using step 4 above, or by just getting over it/seeking profession help in overcoming OCD.


Ryan Sukale said...

Thanks mate. Short and sweet post. Just as i like it!

penguin said...

I wish I could draw a simple line spiral.
i.e a line going in a spiral.

I have searched and searched.

So what I have had to do is tie a piece of string to a pencil and draw it, then scan it into the computer.
2012.. we were meant to have flying cars, but the computer still cant draw a !**&% simple spiral.

dreamer.redeemer said...

Yes, an image manipulation program isn't (and probably shouldn't be expected to be) very good at generating what can be best described as basic mathematical figures. But computers are certainly capable of producing them if you only know how to tell them to; a simple program could be written to do a line spiral (I'm not sure a program to produce a to tone spiral would be so simple, it's at least not obvious how that would be done). A graphing calculator could easily generate one, and since WolframAlpha is more than a calculator will ever hope to be, it can also be used to generate one by asking it to plot a linear function (as in a first degree polynomial of one variable) in polar coordinates, though all that other useful information included with the plot sort of ruins the spiral's potential as an image:
In essence what you did was construct a physical equivalent of the algorithm needed to produce a line spiral, which probably works as well as you need it to.

For what it's worth, the same process described for the two tone spiral in this post can also produce a line spiral if you start with a line instead of the two tones. Of course, drawing lines in GIMP isn't a straightforward as one might hope, you first need to set up a path and then stroke the path.

Flying cars OTOH... classic example of the unfortunately tremendous difference between the ease of imagination and the difficulty (or even impossibility) of implementation.