VFindMe-Home Tech-Home Search

On annotating images with Linux tools

Point to the centre of attention

by : April 15, 2013

The GIMP is a wonderful image editor, but it might be overkill if all you want to do is annotate an image. If you want to highlight a part of an image, so that for example the audience for your presentation can focus on a particular aspect, you'll probably find it easier and more intuitive to do that in a program such as Dia or LibreOffice Draw. Let's see how to annotate an image in all three programs.

As an example, we'll highlight an image by circling an area and creating an arrow to point at the circle. All three of the tools mentioned allow you to work in different layers, separating the edits of the background from the annotations. We'll work with an image of coats of arms that dates from 1876, and highlight the coat of arms for Siam (Thailand), which shows an elephant. You could ask an audience to count down four rows and over two columns, but if you draw a circle around the item, the audience can quickly find it immediately.

With the image loaded in the GIMP, drill down through the menu using Tools -> Selection Tools -> Ellipse Select. Click with the mouse at the top left of the Siam entry and then again at the bottom right. This creates a "marching ants" outline for the circle. Using Windows -> Dockable Dialogs -> Colors set the foreground (drawing) color to a distinctive color to make the circle stand out against the image.

Choose Edit -> Stroke Selection to change line parameters. Choose "Stroke line" to begin testing, with a width of 3 px. It will use the current foreground color and draw a line of the thickness you specify where the marching ants are. You should now have a red circle around the Siam coat of arms. Choose Select -> none to cancel the circle selection. The marching ants will stop and your circle will remain in place.

To draw an arrow, choose Tools -> Paint Tools -> Pencil or Brush. Set the properties of the drawing tool to suit your purposes. The result should be something like Figure 1.
Annotation painted with Gimp

One of the drawbacks of using the GIMP is that the result is not easily editable. You can edit the circle and arrow as a bunch of pixels separate from the underlying image if you paint them onto their own separate layer, but any advanced editing, such as moving the arrow relative to the circle or changing its color, unless each is on its own layer, is not easy.

Annotation in Dia

Now let's attempt the same thing using Dia. Load the image into the main Dia window, then select the ellipse or perfect circle object from the diagram editor and click it onto the base image. Figure 2 shows the initial result of this operation.
Figure 2: Dragging a circle onto the image in Dia

You can use the eight green points to adjust the position and size of the circle over the correct part of the large image. You can also click and drag as needed.

Next, right-click on the circle and choose Properties from the dialog box. Here you can change the color of the circle and its line width. Change "Draw background" to NO; this controls opacity, and the background it refers to is the white background of the circle object. Saying no allows the coat of arms image to show through. In Dia, opacity of objects is either 0 percent or 100; if you need more varied opacity then you should choose a different editor.

At this point you have two objects, the circle and the base image, both sitting on one layer. Since they are both on the same layer, Dia may try to associate them. You may not notice an effect now, but when you add an arrow, Dia will probably try to associate the arrow with the base image. If you see some strange behavior where you cannot place the end of an arrow where you want it, you should remove your objects from the layer, add a new layer through the Layer menu option, and paste the objects onto the new layer. Dia now will not try to associate the annotations with the underlying image if they are on different layers, but will associate them with each other, which is what you want.

To add an arrow, click the line object from the diagram editor palette and click again somewhere in the image outside the circle. This produces a line with an arrowhead. Click on the ends to adjust its position. Dragging the arrow end into the circle lights up the circle to show that the program recognizes that the circle and the arrow should be associated. Release the mouse button and you'll find that the arrow is now connected to the circle.

The two objects can now be treated as a group or separately. If you drag or resize the circle, the arrow will follow it. You can edit each object by selecting it and right-clicking to produce the dialog box.

Figure 3 shows a detail view of the final output. Note that at high resolution there is a little bleeding of the lines into the base image. This would not be noticeable at a distance; the thinner the lines, the worse the bleeding.
Figure 3: Detail of image in Dia

If you export this set of objects as an image, Dia will not preserve the object structure. Make sure to save the structure as a Dia file if you need to come back and edit the objects separately.

Annotation in OpenOffice Draw

OpenOffice Draw, which is just as intuitive as Dia, uses a similar process. You can easily select objects once they have been created, and change their properties at any time. Draw does not have the same library of technical shapes Dia comes with, but it is quite capable with more general shapes.

Also, Draw does not associate or connect objects; that is up to the drawer. In some cases it is more efficient and effective to allow a program such as Dia do this, since the result will usually look more professional, and it makes subsequent editing easier.

In Draw, add a circle in the same way as in Dia, by selecting one of the standard objects. Then you can add an arrow either by placing a plain line and then editing the line to show an arrow at one end, or select an object from the Arrow tool box, which you can make viewable from the View -> Toolbars menu item.
Figure 4: The result in OpenOffice Draw


When you need to annotate images, clearly you have a choice of tools from which you can pick. The GIMP is the way to go if you want to learn just one application that provides all the bells and whistles required to edit your base image as well as add annotation. However, the GIMP does not treat annotations as objects that can be linked together, so it is not easy to edit annotations once they have been created, but you can build them in layers and delete and recreate layers as needed. Also, the GIMP's menu structure is quite complicated; remembering the steps and which menu is where is a challenge unless you are a regular user of the program.

Dia is a good choice if you need to make basic adjustments to an image and need access to a library of technical object shapes to add to your exposition. Most of Dia's commands and buttons are readily visible.

OpenOffice Draw is an excellent midpoint between the GIMP and Dia. It creates annotations as objects as in Dia, but lacks Dia's library of technical object shapes. It does however have a large gallery of fills, which, while not relevant in this case since the background is part of the presentation, would be helpful in a more general context.