Skip to content
Flamenco edited this page Oct 4, 2018 · 25 revisions
  • Methods
    • convert
    • into
    • actions
  • Examples

This task wrap the ImageMagick convert command line executable. To use the Magick task, you must provide a set of files to process with the convert() method, and a sequence of actions applied to these files with the actions() method. You can also provide an output directory for processed files which can be renamed on the fly.

There is an example of Magick task :

task resize(type: com.eowise.imagemagick.tasks.Magick) {
    convert 'img', { include '*.png' }
    into 'outputDir'
    actions {
        -background('none')
        inputFile()
        -resize('50%')
        outputFile()
    }
}

Magick methods

convert

public void convert(String path, PatternSet pattern)

convert is used to specify the input files processed by the task.

path
This is the base path where are input files
pattern
A PatternFilterable used to select input files

into

public void into(String path)
public void into(Closure closure)

actions

public void actions(Closure closure)

actions closure is converted to a string and added as arguments to the ImageMagick convert command line.

The example above is translated to -background none test.png -resize 50% test.png.

You can add a stack with the stack closure.