Automation : Common Tasks
Commands
Here’s the listing of the available commands and their syntax:
| Command & Syntax | Details |
|---|---|
| image_load "file-path"; | Loads an image file. The path of the file is provided via the parameter file-path (quoted string). |
| image_save "file-path"; | Saves the image to a file. The path of the file is provided via the parameter file-path (quoted string). |
| layer_select id; | Sets the active layer. The layer is identified by its zero-based position using the parameter id [0..1024]. |
layer_resize width height; layer_resize width height quality; layer_resize width height quality function; layer_resize width height quality function option param; |
Resizes the layer. For the width and width, you can either provide absolute values or percentages; percentage values must be terminated with a “%” character without spaces, e.g “33.33%”. You have the option of specifying the quality [blocky, normal, high, custom]. If the quality is “custom”, you must specify the function [nearest_neighbour, bilinear, bicubic_cardinal, bicubic_b_spline, bicubic_bc_spline, windowed_sinc]. If the function is “windowed_sinc”, you must specify the window type via option [bartlett, blackman, blackman_harris, bohman, cosine, gauss, hamming, hann, kaiser", lanczos, parzen, rectangular, welch] and the window size via param [1..1024]. Example: |
layer_set_ppi ppi; layer_set_ppi ppi_x ppi_y; |
Updates the physical resolution of the layer in pixels per inch. You can either specify a combined value (positive integer or decimal) using ppi [1..10000] or separate values for the X and Y direction using ppi_x and ppi_y [1..10000]. |
| layer_update_dynamic_content; | Updates dynamic content such as text, linked layer data, or applet linkage data (QR codes, etc.). |
| layer_add_border size; | Adds a border of size size [0..1024] to the image. The direction of flip is set by the parameter direction [horz, vert]. |
| layer_set_canvas width height x_off y_off; | Sets the layer’s canvas such that the new size becomes width by height pixels and the old pixels are inserted at the offset x_off, y_off. |
layer_clean_alpha method #color ; |
Cleans the transparent areas of the current layer. The logic used for the clean is set by the parameter method [plain, content]. |
layer_fill_alpha method #color; |
Applies a solid-color background to the layer. The logic used for the fill is set by the parameter method [plain, content]. |
| layer_edit_AI "prompt"; | Edits an image using a Generative AI prompt. The prompt to be passed to the AI engine is provided via the parameter prompt (quoted string). |