Gimp

From HerzbubeWiki
Jump to: navigation, search

The subject of this page is the GNU Image Manipulation Program, probably better known as The Gimp.

References

Books

  • http://gimp-savvy.com/ (hosts the book "Grokking the GIMP" and an archive of a few thousand copyright-free photo images)


Gimp Tutorials


Glossary

Bezier Selection 
Old name for the Path tool
Path Tool 
Make a selection consisting of a path between points. Tutorial: http://www.gimp.org/tutorials/Bezier_Selections/


Installation on the Mac

These days I once again prefer to use the Gimp provided by gimp.org itself. Download from here. Previously the project "GIMP on OS X" (old link) used to provide a better package, but when last I looked the packages were outdated by almost a year.

Some notes:

  • Scripts go into ~/Library/Application Support/Gimp/scripts
  • No longer requires XQuartz / X11


Customizing the Gimp

Adding a Brush

  • Get the brush (e.g. http://www.gimphelp.org/DL/arrow_brushes_BW_1.tar.bz2)
  • Place it into ~/Application Support/Gimp/brushes
  • In Gimp, in the lower part of the Layer window, open the brushes dialog (may also work with Shift+Ctrl+B)
  • At the very bottom of the dialog, select the "Refresh brushes" symbol
  • The brush should now appar in the brushes dialog


Adding Script-Fu

  • Get the script (e.g. http://registry.gimp.org/files/layerfx.scm)
  • Place it into ~/Application Support/Gimp/scripts
  • In Gimp, select Filters -> Script-Fu -> Refresh Scripts
  • The script should now appear somewhere below the "Filters" menu (unless the script is configured to add itself somewhere else)


Recipes

How to paint single pixels

  1. Select the pencil tool
  2. Choose a 1 pixel brush (the default 1 pixel circle brush is ok)


How to erase single pixels

  1. Select the eraser tool
  2. Choose a 1 pixel brush (the default 1 pixel circle brush is ok)
  3. Enable the "hard edges" option to prevent antialiasing


Select something, then move it to somewhere else

  1. Select whatever you want to move
  2. From the menu, choose Select > Float selection. You will notice that there is now a new layer in the layers window.
  3. Select the move tool
  4. In the tool options, select "Layer", and below that select "Move the active layer"
  5. Now move the selection to its new place
  6. In the layers window, right-click the floating selection layer and choose "Anchor"

It took me about 30 minutes to find this out, even googling and all. Why do simple things have to be so complicated?


Shift the entire image, or the content of a layer

Layer:

  1. Select Layer > Transform > Offset
  2. Enter the parameters you require

Image

  • I have not found a way how to shift the entire image (except when you resize the image via Image > Canvas Size)
  • It seems one has to shift all layers separately


How to create an elliptical outline

  1. The simplest and most flexible approach is to create an elliptical selection and then stroke it. However, the quality of anti-aliasing with this approach is rather crude
  2. A higher quality outline can be obtained by creating two elliptical selections with different sizes, subtracting the inner one from the outer one. The command Select → Border... makes it easy.


How to create arbitrary selections

  1. Create an initial selection with one of the selection tools, e.g. the rectangle selection tool
  2. To subtract from the selection: Press the Ctrl key and start making another selection inside the existing selection (possibly use a different selection tool)
  3. To add to the selection: Ditto, but press the Shift key
  4. Also useful is the command "Select > Border"


How to make a sickle-shaped selection

  1. Choose the Ellipse select tool
  2. Set "Fixed aspect ratio" (or press and hold the Shift key after the next operation has started)
  3. Possibly also set "Expand from centre"
  4. Create a circle-shaped selection; remember where the center is
  5. Change the selection mode to "Subtract from the current selection" (or hold the Ctrl key during the next operation)
  6. Draw another circle with a different center than the first; where the circles intersect the sickle-shape will emerge


How to make background transparent when cutting

  1. Open a .jpg file (or any other image format that does not support transparency)
  2. The image only has a single layer: Select Layer → Transparency → Add alpha Channel. It is important to do this before you cut!
  3. Now you can cut out portions of the image by making a selection and pressing Ctrl+X. Because of the alpha channel the background will nicely appear transparent; without the alpha channel it would be white.


Rotate along any axis

  • A simple rotation around an arbitrary center can be done with the Rotate tool (Shift+R)
  • The Perspective tool can be used to distort an image or layer, giving the impression of depth
  • The best tool for a controlled rotation around any axis is Filters > Map > Map to Object. On the "Orientation" tab you can set any rotation axis and angle. The only problem is that the tool also applies lighting to the transformation. I have not yet found out how to disable this.


Copy layer mask to another layer

  • Select the source layer that contains the layer mask
  • Layer → Mask → Mask To Selection
  • Select the destination layer that will receive the new layer mask
  • Layer → Mask → Add Layer Mask, then choose "Selection"


iOS: Combine two icons

I'm not sure 1) how useful the following technique is outside of the area of creating icons for iOS, or 2) whether the same effect can be achieved more easily, but anyway, here's another recipe.

My concrete problem: I had an existing tab bar / toolbar icon depicting a book, and I wanted to add a question mark ("?") on top of it. A few preparation steps (not part of the actual recipe):

  • The first step was simple: I added the "?" as a new text layer, using white as the text color
  • A slight complication was that the icon depicted the book not in a flat view from the top, but in perspective
  • So in the next step I had to give the "?" text layer the same perspective, using the Perspective tool
  • As a result, the boundaries of the "?" character no longer were crisp, but consisted of some fuzzy grayscale pixels

Now here's the actual recipe:

  • For the question mark to appear correctly, it has to be "cut out" from the solid front cover of the book icon
  • So in effect we need to combine the two layers in a way that causes the information from the white/gray text layer to be converted into information in the main layer's alpha channel
  • Start with the command Layer → Mask → Add Layer Mask, then select "Grayscale copy of layer"
  • Layer → Mask → Mask To Selection
  • Selection → Invert
  • Select the main layer with the icon (or create a duplicate of the layer and work on that if you want to keep the original layer around)
  • With the main layer depicting the icon active, select Layer → Mask → Add Layer Mask, then choose "Selection"
  • Voilà. To save the image as .png you need to perform the final step Layer → Mask → Apply Layer Mask (because the .png format cannot store layer masks)


Tutorials

Check these out: