#### 44.7.2 Selecting graphics to copy from arbitrary locations

In addition to (or instead of) having DITA2Go gather up copies of the graphics files referenced by your DITA document (see §44.7.1 Copying referenced graphics to a distribution directory), you can have DITA2Go copy all or selected graphics files from other locations.

The paths in your DITA document point to the images used during authoring. But different output types require different image formats, so if an image is in the right format for HTML, it is wrong for RTF. You can choose, on a per-project basis, which set of images you want by selecting where to copy them from.

To specify which graphics files to copy and from where:

    [Automation]
    ; CopyGraphicsFrom = path to dir containing graphics files,
    ;  relative OK
    CopyGraphicsFrom = path\to\graphics\files
    ; GraphCopyFiles = list of files to copy from CopyGraphicsFrom,
    ;  from project directory, and from arbitrary locations.
    GraphCopyFiles = *.gif *.jpg G:\special\images\logo.png

CopyGraphicsFrom and GraphCopyFiles take effect when WrapAndShip=Yes, CompileHelp=Yes, or FTSCommand=path\to\indexer (see §44.10 Gathering and processing Help-system files).

Where to get graphics files

When you specify a value for CopyGraphicsFrom, graphics files are copied first from the project directory (unless it is the same as the destination directory), then from the directory designated by CopyGraphicsFrom, to one of the destinations listed in §44.7.1 Copying referenced graphics to a distribution directory. If you specify a relative path for CopyGraphicsFrom, that path is relative to the project directory.

Where to put graphics files

The CopyGraphicsFrom command happens just before the CopyOriginalGraphics command (see §44.7.1 Copying referenced graphics to a distribution directory), and copies to the same place. When WrapAndShip=Yes, that place is the concatenation of the wrap directory (if any) and the value of [Graphics]GraphPath. If no value is specified for GraphPath, files are copied to the wrap directory; if no value is specified for WrapPath, files are copied to a concatenation of the project directory and GraphPath; if neither is specified, files are copied to the project directory.

Which graphics files to copy

You can use GraphCopyFiles to list files to be copied. Table 44-3 shows which graphics files are copied by default for each output type. Files without paths assigned to GraphCopyFiles are always copied first from the project directory, then from the CopyGraphicsFrom directory (if any). If GraphCopyFiles is not specified, or is set to nothing, all relevant graphics files are copied from the project directory and then from the CopyGraphicsFrom directory (if any).

Table 44-3 Default graphics files copied for assembly

Output type | Files copied by default from project directory
DCL, MIF |
    *.bmp *.wmf *.gif *.jpg *.png *.svg *.tif
HTML, XML types |
    *.gif *.jpg *.png *.svg
RTF types |
    *.bmp *.wmf

The file specifications you assign to GraphCopyFiles must be separated by spaces, and no spaces are allowed within a file specification. You can use wildcards in file specifications, and include absolute or relative paths to indicate where graphics files should be copied from. If you do not specify a path, the default is first from the project directory, then from the CopyGraphicsFrom directory (if any). If you specify a relative path, the path is relative to the project directory.

For example, to have DITA2Go copy graphics files for standard HTML output from directory MyGraphics, parallel to the project directory, to directory Images, a subdirectory of the WrapPath directory:

    [Automation]
    WrapAndShip=Yes
    ; WrapPath is relative to the project directory:
    WrapPath=.\Final
    ; CopyGraphicsFrom is relative to the project directory:
    CopyGraphicsFrom=..\MyGraphics

    [Graphics]
    ; GraphPath is relative to the WrapPath directory:
    GraphPath=./images

If you use backslashes for GraphPath, DITA2Go changes them to forward slashes before inserting references in HTML output, from HTML files to image files. See §32.1 Locating graphics files for HTML.

Synchronize with other settings

If you plan to use CopyGraphicsFrom, make sure other graphics settings in the configuration file are consistent with the setting for WrapPath. See:

§44.7.4 Synchronizing graphics settings for HTML output

§44.7.5 Synchronizing graphics settings for RTF output

Use system commands instead

As an alternative, you can collect graphics from multiple locations with a series of system commands in a DITA2Go macro. For example:

    [Automation]
    SystemWrapCommand=<$GetGraphics>

    [GetGraphics]
    cd <$$_currpath>\\wrap
    copy "c:\\my graphics\\*.jpg"
    copy "c:\\more graphics\\*.jpg"

Notice the doubled backslashes (required in DITA2Go macros, where backslash is used as an escape character), and the quotes around paths that includes spaces; see §43.1.5 Supplying system commands in a macro.

Previous Topic: 44.7.1 Copying referenced graphics to a distribution directory

Next Topic: 44.7.3 Deleting prior contents of the graphics destination directory

Parent Topic: 44.7 Placing graphics files for distribution

Sibling Topics:

44.7.1 Copying referenced graphics to a distribution directory

44.7.3 Deleting prior contents of the graphics destination directory

44.7.4 Synchronizing graphics settings for HTML output

44.7.5 Synchronizing graphics settings for RTF output

Table of Contents • Index