Skip to main content

Image Conversion

In this example we will create an image converter that exports PNGs from PSD and EXR images and converts them to the same file format. We use the Commanline application Image Magick for this purpose.

The simple way#

This will cost us less than 10 minutes

  1. First we need to download Image Magick. For us, the portable version that can be downloaded here for Windows and macOS is enough.

  2. we go to the folder Documents/Anchorpoint/actions and create a new folder "ImageMagick". There we add the magick.exe and create an empty YAML file, named "convertImage.yaml".

image

  1. Copy the following content into your "convertImage.yaml. Make sure that the indentations are correct.
version: "1.0"
#Action bodyaction:   #Base parameters  name: "Convert to PNG"  id: "ap::imageMagicConvert"  type: command
  #The parameters for Image Magick  command: "${yamlDir}/magick.exe"   arguments: "convert ${path}[0] -colorspace sRGB ${folder}/${filename}.png"
  #Where should the action appear in the context menu  register:    file:       filter: "*.psd;*.exr;"
  #Handle toast messages  toast:    success:      message: "Image conversion finished"    error:      message: "Something went wrong"    

version:
The version of the action

name
The name of the action, which is shown in the context menu

id
The action id, which has to be unique

type
This is either command (for CLI applications) or python (for Python scripts)

arguments
The parameters which are required to control the CLI application. To enter the proper arguments you have to read the documentation of the CLI application.

register
Here you specify where the action can be called. In this example we use "file" for files and filter the files with file extensions "psd" and "exr".

toast
The message that is displayed when the action is completed.