Ansel supports variable substitution in a number of modules and preference settings. For example:

available variables

The following variables are available, though they may not all be applicable in every context:

 1$(ROLL.NAME)               film roll of the input image
 2$(FILE.FOLDER)             folder containing the input image
 3$(FILE.NAME)               basename of the input image
 4$(FILE.EXTENSION)          extension of the input image
 5$(ID)                      the image id
 6$(VERSION)                 the duplicate version number
 7$(VERSION.IF_MULTI)        same as $(VERSION) but null string if only one version exists
 8$(VERSION.NAME)            version name from metadata
 9$(DARKTABLE.VERSION)       the version of the running Ansel instance
10$(DARKTABLE.NAME)          name of Ansel
11$(SEQUENCE)                a sequence number within an export job
12$(WIDTH.SENSOR)            width of RAW data in pixels before RAW crop
13$(HEIGHT.SENSOR)           height of RAW data in pixels before RAW crop
14$(WIDTH.RAW)               width of RAW data in pixels after RAW crop
15$(HEIGHT.RAW)              height of RAW data in pixels after RAW crop
16$(WIDTH.CROP)              image width in pixels at the end of the pixelpipe, but before export resize
17$(HEIGHT.CROP)             image height in pixels at the end of the pixelpipe, but before export resize
18$(WIDTH.EXPORT)            image width in pixels at the end of the pixelpipe and after export resize
19$(HEIGHT.EXPORT)           image height in pixels at the end of the pixelpipe and after export resize
20$(WIDTH.MAX)               maximum width entered in export module
21$(HEIGHT.MAX)              maximum height entered in export module
22$(YEAR)                    year at date of import/export
23$(MONTH)                   month at date of import/export
24$(DAY)                     day at date of import/export
25$(HOUR)                    hour at time of import/export
26$(MINUTE)                  minute at time of import/export
27$(SECOND)                  second at time of import/export
28$(MSEC)                    millisecond at time of import/export
29$(EXIF.YEAR)               Exif year
30$(EXIF.MONTH)              Exif month
31$(EXIF.DAY)                Exif day
32$(EXIF.HOUR)               Exif hour
33$(EXIF.MINUTE)             Exif minute
34$(EXIF.SECOND)             Exif second
35$(EXIF.MSEC)               Exif millisecond
36$(EXIF.ISO)                Exif ISO value
37$(EXIF.EXPOSURE)           Exif exposure
38$(EXIF.EXPOSURE.BIAS)      Exif exposure bias
39$(EXIF.APERTURE)           Exif aperture
40$(EXIF.FOCAL.LENGTH)       Exif focal length
41$(EXIF.FOCUS.DISTANCE)     Exif focus distance
42$(LONGITUDE)               longitude
43$(LATITUDE)                latitude
44$(ELEVATION)               elevation
45$(STARS)                   star rating (text only)
46$(RATING.ICONS)            star rating (using star characters)
47$(LABELS)                  colorlabels (color labels as text)
48$(LABELS.ICONS)            colorlabels (color labels as icons)
49$(MAKER)                   camera maker
50$(MODEL)                   camera model
51$(LENS)                    lens
52$(TITLE)                   title from metadata
53$(DESCRIPTION)             description from metadata
54$(CREATOR)                 creator from metadata
55$(PUBLISHER)               publisher from metadata
56$(RIGHTS)                  rights from metadata
57$(TAGS)                    tags list (Xmp.dc.Subject)
58$(CATEGORYn(category))     tag name of level n [0,9] of selected category (or tag)
59$(SIDECAR_TXT)             content of the text sidecar file (if any)
60$(FOLDER.PICTURES)         pictures folder
61$(FOLDER.HOME)             home folder
62$(FOLDER.DESKTOP)          desktop folder
63$(OPENCL.ACTIVATED)        whether OpenCL is activated
64$(USERNAME)                user name defined by OS
65$(NL)                      newline character
66$(JOBCODE)                 internal jobcode of current job

string substitution

All of the variables support basic string substitution inspired by bash though some of the details differ.

All patterns are treated as simple string comparisons. There is no regex support.

The following string replacement functions are provided, where var is one of the variables listed above:

 1$(var-default)                   If var is empty, return "default"
 2                                 It is possible to use another variable as "default", e.g.
 3                                 $(WIDTH.CROP-$(WIDTH.RAW))
 4
 5$(var+alt_value)                 If var is set, return "alt_value" else return empty string
 6
 7$(var:offset)                    Return var starting from offset
 8                                 If offset is negative count from the end of the string
 9
10$(var:offset:length)             Starting from offset, return at most length characters of var
11                                 If offset is negative the length is counted from the end of var
12                                 If length is negative this indicates the end of the result,
13                                  counted from the end of var, and not an actual length
14
15$(var#pattern)                   Remove "pattern" from the start of var
16
17$(var%pattern)                   Remove "pattern" from the end of var
18
19$(var/pattern/replacement)       Replace the first occurrence of "pattern" in var with "replacement"
20                                 If "replacement" is empty then "pattern" will be removed
21
22$(var//pattern/replacement)      Replace all occurrences of "pattern" in var with "replacement"
23                                 If "replacement" is empty then "pattern" will be removed
24
25$(var/#pattern/replacement)      If var starts with "pattern then "pattern" is replaced with "replacement"
26
27$(var/%pattern/replacement)      If var ends with "pattern" then "pattern" is replaced with "replacement"
28
29$(var^)                          Make the first character of var uppercase
30
31$(var^^)                         Make all characters of var uppercase
32
33$(var,)                          Make the first character of var lowercase
34
35$(var,,)                         Make all characters of var lowercase

formatting

The image information patterns support markup . For example, adding the following will provide a clear warning (large, red, bold text) when OpenCL has failed to initialise:

<span alpha='1%'>$(OPENCL_ACTIVATED/no/<span foreground='red' weight='heavy' size='xx-large' alpha='100%'>OPENCL ACTIVATION FAILED</span>$(NL))</span>