Documentation/OOoAuthors User Manual/Writer Guide/Working with Graphics

From Apache OpenOffice Wiki
Jump to: navigation, search

Template:NeedsWork This page was created by converting ODT to Mediawiki using Writer2MediaWiki.

This is Chapter 8 of the OpenOffice.org 2.x Writer Guide (Third edition), produced by the OOoAuthors group. A PDF of this chapter is available from the OOoAuthors Guides page at OpenOffice.org.

<< User Manuals page
<< Writer Guide Table of Contents
<< Chapter 7 Working with Styles   |    Chapter 9 Working with Tables >>


Graphics in Writer documents

When you create a text document using OpenOffice.org Writer, you may need to include some graphic illustrations.

Graphics in Writer are of three basic types:

  • Graphic and image files, including photos, drawings, scanned images, and others
  • Diagrams created using Writer’s drawing tools
  • Charts created using OOo’s Chart facility

This chapter covers the first two types of graphic illustrations. Most parts of this chapter also apply to the other components of OOo.

How to add a graphic from a file

OpenOffice.org can import various vector (line drawing) and raster (bitmap) file formats. The most common are GIF, JPEG or JPG, PNG, and BMP. See Graphic file types supported for a full list of supported graphic file types.

Graphics may be downloaded from the Internet, scanned, created with a graphics program, or they may be photos taken with a digital camera. Some questions come to mind:

  • How is a graphic inserted?
  • Should the graphic be included in the document, or should it be linked to the file?
  • How can the size of the graphic be adjusted?
  • How can the relative position between the graphic and the text be changed?

These questions will be discussed in order.

Inserting a graphic from a file

To insert a graphic image from a file, the file must be already stored in a directory (folder) on the computer.

Proceed as follows:

  1. Determine the destination for the image. For example, place the cursor at the appropriate location in the document.
  2. On the main menu, select Insert > Picture > From File. This displays the dialog box shown below.
  3. Navigate to the file to be inserted.
  4. Select the file to insert and click Open.

Insert picture dialog box
Insert picture dialog box

Note: At the bottom of the Insert picture dialog box are two checkboxes. If the Preview checkbox is checked, the selected graphic file is previewed in a pane, so you can verify that you have the correct file. The Link checkbox is discussed below.

Linking a graphic file

If the Link checkbox in the Insert picture dialog box is checked, OOo will create a link to the file containing the graphic, instead of saving a copy of the graphic in the document. The result is that the figure will be displayed in the document, but when the document is saved, it will contain only a reference to the graphic file but not the graphic itself. The document and the image remain as two separate files, and they are merged together only when you open the document again.

Linking an image has two advantages and one disadvantage:

  • Advantage – Linking can reduce the size of the document when it is saved because the image file itself is not included.
  • Advantage – You can modify the image file separately without changing the document because the link to the file remains valid, and the modified image will appear when you next open the document.
  • Disadvantage – If you send the document to someone else, you must also send the image file, or the receiver will not be able to see the linked image.

Resizing a graphic

It is possible, and quite likely, that the inserted image will not fit perfectly into the document because it is too big or too small. Therefore, you will probably need to resize the image.

The position of the image is not relevant for now. Changing the position of an image relative to the text is discussed in “Positioning graphics within the text” on page 9.

You can modify the size of a graphic in two ways:

  • Unscaled resize
  • Scaled resize

The figure below shows three examples of an image inserted into a document and resized.

Resized images
Three examples of resized images, plus the original image

Unscaled resize

In Example 1, the image is in its natural size. When you add a new graphic (and also when you select an existing one by clicking on it), it displays some square points along its perimeter; these are called handles. To resize the graphic:

  1. Move the cursor onto a point.
  2. Click the left mouse button.
  3. Drag the mouse to modify the size of the figure.

This basic resizing process is useful if you need to specify the size and the height independently of each other. The problem with this method, as demonstrated in Example 3, is that when the graphic is not changed to scale, it will be distorted.

You need to either carefully measure and calculate how much the image needs to be adjusted in both the horizontal and vertical directions in order to maintain the correct proportions or use the scaled resize method described below.

Scaled resize

A scaled resize is usually the best option, because it automatically maintains the proportions of the graphic. To perform a scaled resize:

  1. Press and hold the Shift key.
  2. Click and drag a handle of the graphic. It will resize proportionally, as shown in EXAMPLE 2.
  3. Release the mouse button to complete the resize.

Inserting images from other sources

You can insert images from sources other than a file. The possible sources for images are:

From a graphics program

You can use many different graphics programs to edit a graphic file. In these programs, you can select, copy, and paste an image or part of a graphic into an OpenOffice.org document. The figure below shows an example of this procedure, which can be recreated with these steps:

Using a graphics program
Using a graphics program

  1. In the imaging program window, select an area of the image to be copied. (The program used in the example is Paint Shop.)
  2. Move the cursor over the selected area and press Control+C to copy.
  3. Switch to the OpenOffice.org Writer window.
  4. Click to insert the cursor where the graphic is to be inserted.
  5. Press Control+V to paste.

Scanner

If a scanner is connected to your computer, OpenOffice.org can call the scanning application. The scanned item will then be added into the OOo document page as an image. To start this procedure, on the main menu select Insert > Picture > Scan > Select Source.

OpenOffice.org Gallery

The Gallery is available in all components of OpenOffice.org. For an introduction to the Gallery, see Chapter 14 (Working with the Gallery) in the Getting Started guide.

You can select a graphic from the Gallery and drag it into the document. The Gallery icon is located in the right side of the Function Bar. Proceed as follows:

  1. Click on the Gallery icon GalleryIcon.png.
  2. Select the theme containing the image you want to insert.
  3. Click on the image with the left mouse button and, holding the button pressed, drag the image into the document.
  4. Release the mouse button.

The figure below shows an example of an image dragged from the Gallery.

Insert from Gallery
Inserting an image from the Gallery

Adding an image to the Gallery

You may wish to add to the Gallery any images that you use frequently, for example, a company logo. You can then very easily insert these graphics into a document later.

To add images to the Gallery, proceed as follows:

  1. Open the Gallery.
  2. Select the theme where you want to add images, or you can create a new theme. To create a new theme:
    • Click the New Theme button above the list box of Themes. The Properties of New Theme dialog box opens, which is similar to the one shown below.
    • Select the General tab and enter an appropriate name for the new theme in the text box.
    • Select the Files tab, skip step 3, and continue with step 4.
  3. Right-click on the desired theme and select Properties in the pop-up menu. This will display a window from which to select the files to be added.
  4. On the Files page, click the Find Files button. The Select path dialog box opens.
  5. You can enter the path for the file's directory in the Path text box, or you can navigate to locate the file's directory.
  6. Use the File type drop-down list to help limit the search.
  7. Press the Select button to start the search.
  8. A list of graphic files will be displayed in the window. You can use the File type filter again to further limit the search.
  9. Select the files to add. To select more than one file, hold the Control key down while you click on each file.
  10. Finally, click Add.
  11. When you have finished working with the Gallery, you can click on its icon GalleryIcon.png to close it.

Gallery properties dialog box
Gallery properties dialog box

Note: This procedure assumes that the graphic files for the themes already exist. You may need to import some graphics or to create your own onto your computer if the existing files are insufficient.

Note: Similar to the file search function on various operating systems, Find Files searches for graphic files in any subfolders of the directory selected in step 5.

Modifying an image

When you insert a new image or select one already present in the document, the Picture toolbar appears. This toolbar can be either floating or docked. shows what the Picture toolbar looks like when it is floating. Two other toolbars can be opened from this one: the Graphic Filter toolbar, which can be torn off and placed elsewhere on the window and the Color toolbar, which opens as a separate floating toolbar.

From these toolbars, you can apply small corrections to the graphic or obtain special effects.

Note: For more sophisticated adjustments, it is better to use an image manipulation program, such as GIMP. GIMP is an open-source graphics program which can be downloaded from http://www.gimp.org/downloads/.

You can find out more information about the graphic filter and what its elements do by selecting the Find tab in Help (Help > OpenOffice.org Help), pressing the F1 key, or by clicking on an element that has a dialog box and selecting Help. Then, type Graphic Filter Bar into the Search term text box and press Find.



Note: Graphics mode (3) can be Default, Grayscale, Black/White, or Watermark.


Figure 6. Picture toolbar plus tear-off Graphic Filter toolbar and floating Color toolbar

1 From File

2 Filter

3 Graphics mode

4 Color

5 Transparency

6 Flip Horizontally

7 Flip Vertically

8 Graphics Properties

9 Invert

10 Smooth

11 Solarization

12 Aging

13 Charcoal Sketch

14 Relief

15 Mosaic

16 Posterize

17 Pop Art

18 Sharpen

19 Remove Noise

20 Red

21 Green

22 Blue

23 Brightness

24 Contrast

25 Gamma

Figure 7 provides examples of some of the changes available on the Picture toolbar.


Original Image Mirrored Vertically Mirrored Horizontally Light 50%
[[Image:]] [[Image:]] [[Image:]] [[Image:]]
Contrast 50% Red 50% Green 50% Blue 50%
[[Image:]] [[Image:]] [[Image:]] [[Image:]]

Figure 7. Some graphic effects that can be changed from the Picture toolbar

Positioning graphics within the text

When you add a graphic to a text document, you need to choose how to position the graphic with respect to the text and other graphics.

Graphic arrangement refers to the placement of a graphic behind or in front of other graphics or text. Alignment refers to the vertical or horizontal placement of a graphic in relation to the page, frame, paragraph, or character to which it is anchored. Text wrapping refers to the relation of graphics to surrounding text, which may wrap around the graphic on one or both sides, be overprinted behind or in front of the graphic, or treat the graphic as a separate paragraph or character.

Arranging and aligning graphics

You can arrange and align graphics using commands from:

  • The main menu: Format > Alignment (or Arrange, Wrap, Anchor, Flip, ...)
  • By right-clicking on the picture, then Format > Alignment (or Arrange, Wrap, or Anchor)
  • Frame (with the Graphics frame style applied) toolbar
  • Picture dialog box

Frame toolbar

When you select a graphic, the Frame toolbar (shown in Figure 8) may be displayed.

Here you can click icons to apply many arrangement, alignment, wrapping, anchoring, formatting, and other choices.

[[Image:|thumb|<center>
{| class="prettytable" |
1 Apply Style
|
6 Center Horizontal
|
11 Borders
|
16 Bring to Front
|- |
2 Wrap Off
|
7 Align Right
|
12 Line Style
|
17 Send to Back
|- |
3 Page Wrap
|
8 Top
|
13 Line Color (of the border)
|
18 Change Anchor
|- |
4 Wrap Through
|
9 Center
|
14 Background Color
|
19 Link Frames
|- |
5 Align Left
|
10 Bottom
|
15 Frame Properties
|
20 Unlink Frames
|}
Figure 8. Frame toolbar (Graphics object)
]]</center>

Picture dialog box

Click on the graphic to select it and then click Format > Picture, or right-click on the graphic and then click Picture on the pop-up menu, to display the Picture dialog box (Figure 11). Here you can specify the characteristics of the graphic and its placement in detail.

Wrapping text around graphics

On the main menu, click Format > Wrap. The Wrap menu options provide several possibilities:

  • Alternate paragraphs and graphics, maintaining a separation between them (Wrap Off).
  • Wrap text around the graphics (Page Wrap or Optimal Page Wrap).
  • Put a semi-transparent graphic over the text (Wrap Through).
  • Add a graphic in the background (In Background).

Often you need to insert graphics with no text around them, as in this chapter. To set the position of an image to the Wrap Off format, follow these steps:

  1. Select a graphic by clicking on it.
  2. Right-click to display the context menu and move the mouse pointer to Wrap to display the various wrap modes.
  3. Select No Wrap.

The figure below shows an example of this operation.

Changing the wrap of a graphic
Changing the wrap of a graphic

When formatting some documents, such as newsletters, you may want to put photos mixed with text or just want to add some decorative images. The Page Wrap option may satisfy this need. The figure below shows an example of a graphic insertion with the Page Wrap option.

Using the Page Wrap option
Inserting a graphic using the Page Wrap option

When an image is inserted with the Page Wrap option, you can move it anywhere on the page. The text will be automatically adjusted around the image, like water around a sailing boat.

The Optimal Page Wrap option is similar to Page Wrap, but it maintains the text positioned beside the image. The position is decided automatically in order to optimize the relative position between text and image.

Double-clicking on an image pops up the Picture dialog box where you can set all the parameters affecting the image (see figure below). On the Wrap page, you can change the setting for the optimal page wrap.

Wrap page of Picture dialog box
The Wrap page of the Picture dialog box

The Wrap Through option lets you also insert an image overlapping the text. In this case, some part of the text will be hidden, unless you change the transparency of the image.

After changing the transparency, the final result looks like a decal applied over the text, as shown below, where the transparency has been set to 48% in the Transparency spinbox in the Picture toolbar. The words under the image are visible but appear lighter than the rest of the text.

Transparent image
Transparent image added over the text

You can obtain a similar result if you set a graphic's wrap to the In Background format. In this case all the text will be clearly readable, with characters that have the same intensity. However, the background graphic should not be dark; otherwise, the text could be difficult to read. You can also use the Transparency spinbox to control the "transparency”.

Anchoring graphics and drawing objects

You can anchor graphics as a character or to a page, paragraph, or character. You can also place graphics in a frame and anchor the frame to a page, paragraph, or character. Which method you choose depends on what you are trying to achieve.

Here are the ways you can anchor graphics or drawing objects:

To Page
The graphic keeps the same position in relation to the page margins. It does not move as you add or delete text or other graphics. This method is useful when the graphic does not need to be visually associated with a particular piece of text. It is often used when producing newsletters or other documents that are very layout intensive.

Caution: If you plan to use a document within a master document, do not anchor graphics To Page, because the graphics will disappear from the master document. See Chapter 13 (Working with Master Documents) for more information.

To Paragraph
The graphic is associated with a paragraph and moves with the paragraph. It may be placed in the margin or another location. This method is useful as an alternative to a table for placing icons beside paragraphs.

To Character
The graphic is associated with a character but is not in the text sequence. It moves with the paragraph but may be placed in the margin or another location. This method is similar to anchoring to a paragraph but cannot be used with drawing objects.

As Character
The graphic is placed in the document like any other character and, therefore, affects the height of the text line and the line break. The graphic moves with the paragraph as you add or delete text before the paragraph. This method is useful for keeping screenshots in sequence in a procedure or for adding a small icon in sequence in a sentence.

To Frame
If the graphic has been placed in a frame, you can anchor the graphic in a fixed position inside the frame. The frame can then be anchored to the page, a paragraph, or a character, as required.

Adding captions to graphics

You can add captions to graphics in three ways: automatically, by using the Caption dialog box, or manually.

Adding captions automatically

You can set up OOo to add captions automatically whenever you insert a graphic, a table, or other objects into a document. You can choose which objects are captioned automatically, what the sequence name is for each caption (for example, “Table” or “Illustration”), and the position of the caption.

To set up automatic captions:

  1. Click Tools > Options > OpenOffice.org Writer. Click on the + sign to open the different options. The Options – OpenOffice.org Writer – AutoCaption dialog box opens.
  2. Select AutoCaption. Now you can see several choices at the right of the dialog box for adding captions automatically.
  3. On the AutoCaption dialog box, choose which objects will be automatically captioned and specify the characteristics of the captions.

For more information, see "AutoCaption options” in Chapter 2 (Setting up Writer).

When you insert a graphic, if automatic captioning is enabled, the graphic will be placed in a frame along with a caption containing the default sequence name for graphics―Illustration. Position the cursor in the caption area and type the text for the caption. You can change the sequence name by selecting one from the drop-down Category list.

Note: You can specify where to place an automatic caption for any object except a picture; picture captions can only be automatically placed below the picture. If you need a caption above the picture (for example, for data plots in scientific publications), you must add the captions manually, as described in Adding captions manually.

Tip: A common sequence name—Figure—is not one of the names provided: <None>, Drawing, Illustration, Table, and Text. If you want a custom name for your graphics, do the following:

  1. Open the Options – OpenOffice.org Writer—AutoCaption dialog box, described above.
  2. Under the Add captions automatically when inserting section, check OpenOffice.org Writer Picture.
  3. With the mouse, highlight the text Add captions automatically when inserting, if it is not already highlighted. This actives the Caption area in the dialog box for pictures (graphics).
  4. Under the Category drop-down list, enter the name that you want added (say, Figure), by overwriting any sequence name in the list. (Overwriting the term will not delete it from the drop-down list.) You can also set some options for the number style and for a separator between the name and the number, if desired. Click OK to save the changes.

Using the Caption dialog box

To add captions using the Caption dialog box:

  1. Insert the graphic, then select it and click Insert > Caption.
  2. Under Properties on the Caption dialog box, make your selections for the Category, Numbering, and Separator fields (Illustration, Arabic (1 2 3), and a colon (:), respectively, for the example in the figure) and type your caption text in the Caption text box at the top. Whatever text you enter for the caption appears in the box at the bottom, after the sequence name, number, and separator.
  3. Defining the caption
    Defining the caption for an illustration

    Tip: In the Category box, you can type any name you want, for example, Figure. OOo will create a numbering sequence using that name.

  4. Click OK. The graphic and its caption are placed in a frame, as shown below.
  5. Example of graphic and caption
    Illustration 1. An example

    An example of a graphic and its caption contained in a frame. The outer box shows the edge of the frame; this border is normally set to be invisible.

Adding captions manually

You can add a caption to a graphic manually in two ways.

Method 1: Override the category and positioning defaults for captions

  1. Select the picture, right-click on it, and select Caption.
  2. On the Caption dialog box (Figure 13), select <None> in the Category list and click OK.
  3. Right-click on the picture and select Caption. Now you can select a caption type (or type your own sequence category) in the Category drop-down list and, optionally, select Above in the Position list. (If you want the caption to appear at the top, you must add the caption manually.) You can type the actual caption in the box under Caption or you can fill it in later—after the (incomplete) caption is inserted.
  4. Click OK.

Note: If you want the caption to appear at the bottom, you can skip step 2 and the first part of step 3.

Method 2: Place the graphic and its caption in separate paragraphs

  1. Insert the graphic and anchor it to its paragraph as a character. Press Enter to create a new paragraph for the caption.
  2. In the caption paragraph, type, for example, Figure and add a space.
  3. To insert the figure number, click Insert > Fields > Other and select the Variables tab.
  4. Select Number range in the Type list. Select Figure in the Selection list and choose, for example, Arabic (1 2 3) in the Format drop-down list. Click the Insert button.
  5. A number will appear after the word “Figure” in the caption. Now, type the text of the caption.

Tips: If you are manually adding captions to a lot of figures using Method 2, you might want to make an AutoText entry containing, for example, Figure and a space, the figure-number field, and an optional separator and a space after it.

You can also place the caption paragraph before (above) the picture paragraph. Using AutoText can be a convenient way to deal with the lack of automatic captioning above pictures.

Using Writer’s drawing tools

You can use Writer’s drawing tools to create graphics, such as simple diagrams using rectangles, circles, lines, text, and other objects. Group the drawing objects to make sure they stay together the way you intended.

You can use the drawing tools to place drawing objects directly on a page in your document, or you can insert the drawing objects into a frame.

You can also use the drawing tools to annotate photographs, screen captures, or other illustrations produced by other programs, but this is not recommended because:

  • You cannot include graphics in a group with drawing objects, so they may get out of alignment in your document.
  • If you convert a Writer document to another format, such as HTML, the drawing objects and the graphics will not remain associated; they will be saved separately.

Instead, use OOo Draw or another graphics program to annotate illustrations.

Creating drawing objects

To begin using the drawing tools, display the Drawing toolbar (Figure 15), by clicking View > Toolbars > Drawing.

If you are planning to use the drawing tools repeatedly, you can tear off this toolbar and move it to a convenient place on the window.

[[Image:|thumb|<center>
1 Select5 Freeform Line 9 Symbol Shapes13 Stars
2 Line6 Text10 Block arrows14 Points
3 Rectangle7 Callouts11 Flowcharts15 Fontwork Gallery
4 Ellipse8 Basic Shapes12 Callouts16 From File
17 Extrusion On/Off
Figure 15. The Drawing toolbar
]]</center>

To use a drawing tool:

  1. Click in the document where you want the drawing to be anchored. You can change the anchor later, if necessary.
  2. Select the tool from the Drawing toolbar (Figure 15). The mouse pointer changes to a drawing-functions pointer [[Image:]].
  3. Move the cross-hair pointer to the place in the document where you want the graphic to appear and then click-and-drag to create the drawing object. Release the mouse button. The selected drawing function remains active, so you can draw another object of the same type.
  4. To cancel the selected drawing function, press the Esc key or click on the Select icon (the arrow) on the Drawing toolbar.
  5. You can now change the properties (fill color, line type and weight, anchoring, and others) of the drawing object using either the Drawing Object Properties toolbar (Figure 16) or the choices and dialog boxes reached by right-clicking on the drawing object.

Setting or changing properties for drawing objects

To set the properties for a drawing object before you draw it:

  1. On the Drawing toolbar (Figure 15), click the Select tool.
  2. On the Drawing Object Properties toolbar (Figure 16), click on the icon for each property and select the value you want for that property.
  3. For more control, or to define new attributes, you can click on the Area or Line icons on the toolbar to display detailed dialog boxes.

The default you set applies to the current document and session. It is not retained when you close the document or close Writer, and it does not apply to any other document you open. The defaults apply to all the drawing objects except text objects.

[[Image:|thumb|<center>
1 Line5 Line Color 9 To Foreground13 Alignment
2 Arrow Style6 Area10 To Background14 Change Anchor
3 Line Style7 Area Style / Filling11 Bring to Front15 Ungroup
4 Line Width8 Rotate12 Send to Back16 Group
Figure 16. Drawing Object Properties toolbar
]]</center>

To change the properties for an existing drawing object:

  1. Select the object.
  2. Continue as described above.

You can also specify the position and size, rotation, and slant and corner radius properties of the drawing object:

  1. Right-click on the drawing object and then click Position and Size from the pop-up menu. The Position and Size dialog box is displayed.
  2. Choose any properties, as required.

Grouping drawing objects

  1. Select one object, then hold down the Shift key and select the others you want to include in the group. The bounding box expands to include all the selected objects.
  2. With the objects selected, hover the mouse pointer over one of the objects and click either Format > Group > Group or right-click and then click Group > Group on the pop-up menu.

Note: You cannot include an embedded or linked graphic in a group with drawing objects.

Graphic file types supported

OpenOffice.org Writer can open the file types listed in Table 1. Many of these file types are hyperlinked to Wikipedia for their definitions and other information.

Table 1. Graphic file types supported by OpenOffice.org Writer

File extension File type
BMP
Windows Bitmap
DXF
AutoCAD Drawing Interchange (Exchange) Format
EMF
Enhanced Metafile
EPS
Encapsulated PostScript
GIF
Graphics Interchange Format
JPG, JPEG, JFIF, JIF
Joint Photographic Experts Group
MET
OS/2 Metafile
PBM
Portable Bitmap
PCD
Kodak Photo CD
PCT
Macintosh QuickDraw PICT
PCX
Zsoft PC Paintbrush
PGM
Portable Graymap
PNG
Portable Network Graphics
PPM
Portable Pixelmap
PSD
Adobe Photoshop Document
RAS
Sun Raster Image
SGF
StarWriter Graphics Format
SGV
StarDraw 2.0
SVM
StarView Metafile
TGA
Truevision Targa
TIF, TIFF
Tagged Image File Format
WMF
Windows Metafile
XBM
X Bitmap
XPM
X PixMap


Content on this page is licensed under the Creative Common Attribution 3.0 license (CC-BY).
Personal tools