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