NPS Image Editor does not include AI assistance features for scripting. However you may paste the below .MD into your AI assistant
of choice to help write scripts.
# NPSS - NPS Scripting Language Reference
NPSS is the built-in automation language of the NPS Image Editor. This document
is a complete reference for **writing and generating** NPSS scripts. Scripts are
saved as `.npss` files and run from the **Script** menu, the **Script Editor**,
or **Script ? Run Action...**.
## At a glance
- **Line-oriented.** One statement per line. Leading whitespace is ignored.
- **Comments** start with `#` (whole-line only).
- **Blank lines** are ignored.
- **Variables** use `$Name`; assign with `Set Name=value`. Case-insensitive.
- **Strings** use `"double"` or `'single'` quotes. `$Name` is interpolated
inside strings; `\n` becomes a newline.
- **Blocks**: `If` / `Repeat` / `ForEach Layer`, each closed by
`EndIf` / `EndRepeat` / `EndForEach`. Blocks nest.
- **Errors** in a command or variable show a dialog and **abort** the script
(except read-only-variable writes, which only warn).
```npss
# A minimal script
Set Name=World
Alert "Hello, $Name!"
```
## Syntax rules
1. Each line is `CommandName rest-of-line`, split on the **first space**.
2. Whitespace before a line is trimmed, so you may indent freely for readability.
3. A line that is empty or begins with `#` is ignored.
4. Variable names are **case-insensitive**. The `$` prefix is required when
*reading* (`$Foo`) and optional on the *target* of `Set` (`Set Foo=1` and
`Set $Foo=1` are equivalent).
### Value resolution
Any argument is resolved as follows:
- `"text"` or `'text'` ? a **string literal**; `$Name` inside is interpolated
and `\n` becomes a newline.
- A bare number (e.g. `42`, `-3.5`) ? a **numeric literal**.
- `$Name` ? the variable's value (an undefined variable resolves to `""`).
- `-$Name` ? the numeric **negation** of a numeric variable.
- Anything else ? treated as a bare string (with `$Name` interpolation).
Interpolation only replaces `$` followed by letters, digits, or `_`
(regex `\$[A-Za-z0-9_]+`).
### Relative coordinates
Drawing/geometry commands (`Draw`, `Select`, `Resize`, `Offset`,
`CanvasSize`, ...) resolve each coordinate against the relevant maximum
(canvas/layer width or height):
- `""` ? `0`
- `rnd` ? a random value in the range
- `N%` ? that percentage of the maximum (e.g. `50%` ? half)
- `-N` ? maximum minus N (measured from the far edge)
- otherwise ? the literal number
```npss
Draw 0% 0% 100% 100% # fill the whole layer
Resize 50% 50% # halve the image
```
## Built-in statements
These keywords are handled directly by the interpreter (they are not "commands"
and never reach the host). `VAR` is a variable name (with or without `$`).
| Statement | Syntax | Description |
|---|---|---|
| `Set` | `Set VAR=<expr>` | Assign a resolved value. RHS splits on **every** `=` and keeps field 2 - `Set a=b=c` stores `b`. |
| `Increment` | `Increment VAR [amount]` | Add `amount` (default `1`) to a numeric `VAR` (blank counts as `0`). |
| `Add` | `Add VAR <number>` | `VAR = VAR + number`. |
| `Multiply` | `Multiply VAR <number>` | `VAR = VAR x number`. |
| `Round` | `Round VAR` | Round `VAR` to the nearest integer. |
| `Randomize` | `Randomize VAR <min> <max>` | Set `VAR` to a random integer in `[min, max]`. |
| `Append` | `Append VAR "text"` | Append `text` to `VAR` (quote-aware). |
| `Prompt` | `Prompt VAR ["text"]` | Ask the user for a value. Cancel ? `""`. |
| `PromptBoolean` | `PromptBoolean VAR ["text" ["yes" "no"]]` | OK ? `"True"`, otherwise `"False"`. |
| `Push` | `Push VAR1 VAR2 ...` | Save the current value(s) of one or more variables (incl. system variables). |
| `Pop` | `Pop VAR1 VAR2 ...` | Restore previously pushed value(s). Popping a name that was never pushed aborts. |
`Push`/`Pop` are the idiomatic way to leave tool/color state as you found it:
```npss
Push DrawingTool BackColor
Set DrawingTool=Pencil
Set BackColor=$ForeColor
# ...draw...
Pop DrawingTool BackColor
```
## Blocks
Block start/end matching is **prefix-based** on the trimmed, lowercased line, and
blocks nest. A missing or mismatched end aborts the script.
### If
```npss
If <expression>
# runs only when the expression is true
EndIf
```
### Repeat
Runs its body `N` times. `$LOOP_ITER` holds the current iteration
(`0`?`N-1`) and is reset to `0` after the loop.
```npss
Repeat 5
Alert "Iteration $LOOP_ITER"
EndRepeat
```
### ForEach Layer
Iterates every layer, making each the active layer in turn, then restores the
original active layer. Requires an open document.
```npss
ForEach Layer
Set ActiveLayerOpacity=50
EndForEach
```
## Expressions (`If`)
An `If` expression is `<A> <operator> <B>`. The interpreter scans for the
**first** operator it finds, in this order (most specific first):
`!=`, `=`, `<=`, `<`, `>=`, `>`, ` like `, ` contains `. Because the
first match wins, always surround operators with spaces to avoid surprises.
Available operators: `=`, `!=`, `<`, `<=`, `>`, `>=`, `Like`, `Contains`.
- `=` / `!=` - string equality (case-sensitive; literal `true`/`false` compared
case-insensitively).
- `<`, `<=`, `>`, `>=` - **numeric** comparison (blank ? `0`; non-numeric aborts).
- `contains` - case-sensitive substring test.
- `like` - VB-style pattern match: `*` (any run), `?` (one char), `#` (one
digit), `[abc]` / `[a-z]` (character set), `[!abc]` (negated set).
With **no** operator, the value is tested for truthiness: `"0"`, `"false"`,
`"no"`, and `""` are false; everything else is true.
```npss
If $Count > 10
Alert "Lots of items"
EndIf
If $Name like "IMG_####"
Alert "Looks like a camera filename"
EndIf
```
## Filters and extensions
A command whose first dot-segment is `Filter` or `Extension`
(case-insensitive) invokes that filter/extension:
- **No parameters** ? opens the filter's interactive dialog.
- **Any parameters** ? runs with those parameters. Add `Silent=True` to force
it to run without a dialog. Parameter keys may be nested (`Channels.Red=True`).
```npss
Filter.Grayscale Silent=True
Filter.Threshold Threshold=128 Channels.Red=True Channels.Green=False Channels.Blue=False
```
## System variables
Variables are read with `$Name` and written with `Set Name=value`. Names are
**case-insensitive**. Reads resolve *system* variables first, then user
variables, otherwise the empty string. Writing a **read-only** system variable
shows an error but the script keeps running.
### Settable system variables
| Variable | Allowed values |
|---|---|
| `ActiveLayer` | _(free-form value)_ |
| `ActiveLayerBlendingMode` | `Normal`, `Dissolve`, `Keyed`, `Multiply`, `Screen`, `Overlay`, `HardLight`, `SoftLight`, `HardMix`, `ColorDodge`, `ColorBurn`, `Add`, `Subtract`, `Divide`, `Difference`, `Exclusion`, `LightenOnly`, `DarkenOnly`, `LighterColor`, `DarkerColor`, `BitwiseAND`, `BitwiseOR`, `BitwiseXOR`, `BitwiseXNOR`, `BitwiseOverIMPBase`, `BitwiseBaseIMPOver`, `HSLHue`, `HSLSaturation`, `HSLColor`, `HSLLightness`, `HSLRollHue`, `RGBRed`, `RGBGreen`, `RGBBlue`, `RGBAverage` |
| `ActiveLayerColorMode` | `TrueColor`, `HighColor`, `WebSafe`, `Grayscale`, `Bitmap`, `Indexed`, `Palette` |
| `ActiveLayerPalette` | _(free-form value)_ |
| `ActiveLayerTransparencyMode` | `AlphaChannel`, `AlphaBit`, `TransparentColor`, `None` |
| `ActiveLayerOpacity` | _(free-form value)_ |
| `ActiveLayerName` | _(free-form value)_ |
| `AirbrushShape` | `SquareNoise`, `RoundNoise`, `SquareSmooth`, `RoundSmooth` |
| `AirbrushIntensity` | _(free-form value)_ |
| `AnimationRepeat` | `True`, `False` |
| `BrushShape` | `FilledSquare`, `FilledCircle`, `HollowSquare`, `HollowCircle`, `StraightCross`, `DiagonalCross`, `CaligraphyNE`, `CaligraphyNW`, `HorizontalLine`, `VerticalLine` |
| `BrushConnected` | `True`, `False` |
| `BucketFillMode` | `All`, `Contiguous`, `Bounded`, `Inverse` |
| `BucketFillDirections` | `4`, `8` |
| `BucketFillTolerance` | _(free-form value)_ |
| `BucketFillTransparencyAware` | `True`, `False` |
| `ColorCompositingMode` | `Blend`, `Overwrite` |
| `ColorCyclingMode` | _(free-form value)_ |
| `DocumentEnableAnimation` | `True`, `False` |
| `DocumentFrameMode` | `True`, `False` |
| `DocumentGlobalColorMode` | `True`, `False` |
| `DrawingTool` | `Pointer`, `Move`, `RectangularSelect`, `Hand`, `FreeformSelect`, `Zoom`, `MagicWand`, `Gradient`, `Eyedropper`, `Fill`, `Pencil`, `Eraser`, `Airbrush`, `FilterTool`, `Line`, `Warp`, `BasicRectangle`, `RoundedRectangle`, `Ellipse`, `Polygon`, `Text`, `Bezier`, `Clone`, `TextureBrush`, `Brush`, `CustomBrush` |
| `EyedropperScope` | `ActiveLayer`, `AllLayers`, `Screen` |
| `ForeColor` | _(free-form value)_ |
| `BackColor` | _(free-form value)_ |
| `LineWidth` | _(free-form value)_ |
| `SelectionCompositingMode` | `Blend`, `Overwrite` |
| `ShapeFillMode` | `BorderFill`, `BorderOnly`, `FillOnly` |
| `Text` | _(free-form value)_ |
| `TextAlignment` | `TopLeft`, `TopCenter`, `TopRight`, `MiddleLeft`, `MiddleCenter`, `MiddleRight`, `BottomLeft`, `BottomCenter`, `BottomRight` |
| `TextBackground` | `Transparent`, `Solid`, `Rounded`, `AverageColor`, `Blur` |
| `TextEffect` | `None`, `Outline`, `Sponge`, `Shadow`, `SimpleShadow`, `Glow`, `GradientH`, `GradientV` |
| `TextFont` | _(free-form value)_ |
| `TextFontSize` | _(free-form value)_ |
| `TextFontStyle` | `Bold`, `Italic`, `Underline`, `Strikeout`, `Bold Italic`, `Bold Underline`, `Bold Strikeout`, `Bold Italic Underline`, `Bold Italic Strikeout`, `Italic Underline`, `Italic Strikeout`, `Italic Underline Strikeout`, `Underline Strikeout`, `Bold Italic Underline Strikeout` |
| `TransparencyEditingMode` | `Alpha`, `Keyed`, `Opaque` |
| `ZoomLevel` | _(free-form value)_ |
### Read-only system variables
`ActiveLayerHeight` � `ActiveLayerWidth` � `ActiveLayerDisplayName` � `ActiveLayerUniqueID` � `FileName` � `DocumentHeight` � `DocumentOpen` � `DocumentWidth` � `InstanceID` � `LayerCount` � `NOW` � `SelectionActive` � `SelectionX` � `SelectionY` � `SelectionHeight` � `SelectionWidth` � `MemoryUsedMB` � `MemoryBudgetMB` � `MemoryHeadroomMB` � `PendingUndoMB` � `MaterialisedLayerCount`
There is also the special loop variable `$LOOP_ITER` (see **Repeat**), and any
number of user-defined variables you create with `Set`.
## Commands
Every command below is what the in-app Script Editor's **Commands ?** menu
inserts. `<...>` marks a value you supply. A command taking a fixed value set
links to its list under [Value lists](#value-lists). Commands accept either
positional arguments (`SetTool Pencil`) or `Key=Value` arguments where noted
in the VB host; both forms are shown throughout the samples.
### Script Control
| Command | Usage | Accepts |
|---|---|---|
| `Scope` | `Scope <value>` | `Selection`, `Layer`, `Document`, `Instance` |
| `Abort` | `Abort` | |
| `ExecScript` | `ExecScript "C:\\Path\\To\\File"` | |
| `Sleep` | `Sleep 1000` | |
| `LogMemory` | `LogMemory "Label goes here"` | |
| `RequireHeadroom` | `RequireHeadroom 64` | |
| `Alert` | `Alert "Message goes here"` | |
| `Alert (complex)` | `Alert "Title goes here" "Message goes here"` | |
| `Log` | `Log "Message goes here"` | |
| `LogInfo` | `LogInfo "Message goes here"` | |
| `LogWarning` | `LogWarning "Message goes here"` | |
| `LogError` | `LogError "Message goes here"` | |
| `Emit` | `Emit "Message goes here"` | |
| `UpdateStatus` | `UpdateStatus "Message goes here"` | |
| `ClearStatus` | `ClearStatus` | |
| `PromptAction` | `PromptAction` | |
| `ExplainTool` | `ExplainTool <value>` | [DrawingTool](#value-lists) |
### Variable Operations
| Command | Usage | Accepts |
|---|---|---|
| `Push` | `Push <value>` | any variable name (see [System variables](#system-variables)) |
| `Pop` | `Pop <value>` | any variable name (see [System variables](#system-variables)) |
| `Increment` | `Increment <value>` | `<VariableName> <Amount>`, `LineWidth <Amount>`, `ZoomLevel <Amount>` |
| `Add` | `Add VariableName <Amount>` | |
| `Multiply` | `Multiply VariableName <Amount>` | |
| `Randomize` | `Randomize VariableName <Min> <Max>` | |
| `Round` | `Round VariableName` | |
| `Append` | `Append VariableName "Text to add"` | |
| `Prompt` | `Prompt VariableName` | |
| `Prompt (with custom text)` | `Prompt VariableName "Custom prompt message"` | |
| `PromptBoolean` | `PromptBoolean VariableName` | |
| `PromptBoolean (with custom text)` | `PromptBoolean VariableName "Custom prompt message" "True text" "False text"` | |
| `PromptColor` | `PromptColor VariableName` | |
| `PromptFileOpen` | `PromptFileOpen VariableName` | |
| `PromptFileSave` | `PromptFileSave VariableName` | |
| `LoadSetting` | `LoadSetting <Key> VariableName` | |
| `SaveSetting` | `SaveSetting <Key> VariableName` | |
### Undo and Steps
| Command | Usage | Accepts |
|---|---|---|
| `BeginStep` | `BeginStep "My Step"` | |
| `EndStep` | `EndStep` | |
| `MarkClean` | `MarkClean` | |
| `MarkDirty` | `MarkDirty` | |
| `PurgeUndo` | `PurgeUndo` | |
| `CommitAutosave` | `CommitAutosave` | |
| `Undo` | `Undo` | |
| `Redo` | `Redo` | |
| `Refresh` | `Refresh` | |
### Loops and Conditionals
| Command | Usage | Accepts |
|---|---|---|
| `If` | `If $variable="value" <br> #Code goes here<br>EndIf` | |
| `Repeat` | `Repeat 2<br> #Code goes here. Use $LOOP_ITER to get iteration count.<br>EndRepeat` | |
| `ForEach Layer` | `ForEach Layer <br> #Code goes here. Active layer is set automatically.<br>EndForEach` | |
### Layers
| Command | Usage | Accepts |
|---|---|---|
| `AddLayer` | `AddLayer` | |
| `AddLayer (named)` | `AddLayer <Name>` | |
| `DuplicateLayer (active)` | `DuplicateLayer` | |
| `DuplicateLayer (specified)` | `DuplicateLayer <n>` | |
| `DeleteLayer` | `DeleteLayer` | |
| `RenameActiveLayer` | `RenameActiveLayer <Name>` | |
| `AddLayerMask` | `AddLayerMask` | |
| `MaskToLayer` | `MaskToLayer` | |
| `DecomposeLayer` | `DecomposeLayer` | |
| `ComposeLayer` | `ComposeLayer` | |
| `FlattenImage` | `FlattenImage` | |
| `MergeDown` | `MergeDown` | |
| `MergeVisible` | `MergeVisible` | |
| `FitToCanvas` | `FitToCanvas` | |
| `LayerLocked` | `LayerLocked <value>` | `True`, `False` |
| `LayerVisibility` | `LayerVisibility <value>` | `True`, `False` |
| `SetGlobalColorMode` | `SetGlobalColorMode <value>` | `True`, `False` |
### Drawing
| Command | Usage | Accepts |
|---|---|---|
| `BeginDraw` | `BeginDraw <X> <Y>` | |
| `Draw (within Begin/End)` | `Draw <X> <Y>` | |
| `Draw (single operation)` | `Draw <X1> <Y1> <X2> <Y2>` | |
| `EndDraw` | `EndDraw <X> <Y>` | |
| `SetCursor` | `SetCursor <value>` | [PaintCursor](#value-lists) |
| `SetTool` | `SetTool <value>` | [DrawingTool](#value-lists) |
| `ClearImage` | `ClearImage` | |
| `ApplyFilter` | `ApplyFilter <value>` | [InternalFilter](#value-lists) |
### Image Operations
| Command | Usage | Accepts |
|---|---|---|
| `CanvasSize` | `CanvasSize <Width> <Height> <Alignment>` | |
| `CanvasSize (advanced)` | `CanvasSize Width=<Width> Height=<Height> Alignment=<Alignment> FillColor=<Color>` | |
| `CombineMask` | `CombineMask` | |
| `Flip` | `Flip <value>` | `Horizontal`, `Vertical`, `Both` |
| `InvertColors` | `InvertColors` | |
| `ApplyLUT` | `ApplyLUT "LUT Name"` | |
| `SetAverageColor` | `SetAverageColor` | |
| `SwapAlphaMask` | `SwapAlphaMask` | |
| `MakeOpaque` | `MakeOpaque` | |
| `Offset` | `Offset <X> <Y>` | |
| `PickChannels` | `PickChannels <Red> <Green> <Blue> <Alpha> <Mask>` | |
| `Resize` | `Resize <Width> <Height>` | |
| `Rotate` | `Rotate <Angle>` | |
| `Rotate (advanced)` | `Rotate Angle=<Angle> Expand=<Bool> FillColor=<FillColor> InterpolationMode=<InterpolationMode>` | |
| `Skew` | `Skew <XDegrees> <YDegrees>` | |
| `Tile` | `Tile <TileCountX> <TileCountY>` | |
### Animation
| Command | Usage | Accepts |
|---|---|---|
| `AnimationNextFrame` | `AnimationNextFrame` | |
| `AnimationPrevFrame` | `AnimationPrevFrame` | |
| `AnimationPlay` | `AnimationPlay` | |
| `AnimationPlayOnceAndWait` | `AnimationPlayOnceAndWait` | |
| `AnimationPause` | `AnimationPause` | |
| `AnimationReset` | `AnimationReset` | |
| `AnimationGenerateFullFrames` | `AnimationGenerateFullFrames` | |
| `SetAllFrameDelay` | `SetAllFrameDelay` | |
| `SetAllFrameDisposal` | `SetAllFrameDisposal` | |
| `AnimationSpin` | `AnimationSpin <FrameCount> <TotalDuration> <Background> <InterpolationMode> <Reverse>` | |
### Selection and Object
| Command | Usage | Accepts |
|---|---|---|
| `Cut` | `Cut` | |
| `Copy` | `Copy` | |
| `CopyActiveLayerToClipboard` | `CopyActiveLayerToClipboard` | |
| `CopyMerged` | `CopyMerged` | |
| `Paste` | `Paste` | |
| `Delete` | `Delete` | |
| `Select` | `Select <X> <Y> <Width> <Height>` | |
| `SelectCopy` | `SelectCopy <X> <Y> <Width> <Height>` | |
| `SelectAll` | `SelectAll` | |
| `SelectAllContent` | `SelectAllContent` | |
| `FindNext` | `FindNext` | |
| `SelectionToLayer` | `SelectionToLayer` | |
| `InvertSelection` | `InvertSelection` | |
| `MoveObject` | `MoveObject <value>` | [ObjectMoveType](#value-lists) |
| `RefineSelection` | `RefineSelection <value>` | [SelectionRefineType](#value-lists) |
| `Deselect` | `Deselect` | |
| `ClearSelection` | `ClearSelection` | |
| `PlaceSelection` | `PlaceSelection` | |
| `ClearBezier` | `ClearBezier` | |
| `PlaceBezier` | `PlaceBezier` | |
| `MeasureText` | `MeasureText TextWidth "Text goes here"` | |
| `PlaceText` | `PlaceText` | |
| `RasterizeText` | `RasterizeText` | |
| `CropFit` | `CropFit <Target> <Source>` | |
| `CropToContent` | `CropToContent` | |
| `CropToSelection` | `CropToSelection` | |
### Document
| Command | Usage | Accepts |
|---|---|---|
| `NewDocument` | `NewDocument` | |
| `NewDocument (template)` | `NewDocument <TemplateName>` | |
| `OpenDocument` | `OpenDocument "C:\\Path\\to\\file"` | |
| `OpenDocumentMRU` | `OpenDocumentMRU <index>` | |
| `CloseDocument` | `CloseDocument` | |
| `PasteAsNewImage` | `PasteAsNewImage` | |
| `LoadSelection` | `LoadSelection "C:\\Path\\to\\file"` | |
| `Save` | `Save` | |
| `SaveCopy` | `SaveCopy "C:\\Path\\To\\File"` | |
### Window and Instance Control
| Command | Usage | Accepts |
|---|---|---|
| `NewInstance` | `NewInstance` | |
| `Exit` | `Exit` | |
| `CommitSettings` | `CommitSettings` | |
| `CopySettingsToAllInstances` | `CopySettingsToAllInstances` | |
| `ReloadSettings` | `ReloadSettings` | |
| `SaveSettings` | `SaveSettings` | |
| `CloseLayerList` | `CloseLayerList` | |
| `OpenLayerList` | `OpenLayerList` | |
| `CloseAllMenus` | `CloseAllMenus` | |
| `DragCancel` | `DragCancel` | |
| `LoadSwatches` | `LoadSwatches "PaletteName.npl"` | |
| `LoadClassicPalette (by name)` | `LoadClassicPalette "Palette Name"` | |
| `LoadClassicPalette (specified colors)` | `LoadClassicPalette "Red\|Orange\|Yellow\|Green\|Blue\|Indigo\|Violet"` | |
### Interactive UI
| Command | Usage | Accepts |
|---|---|---|
| `UiFileNew` | `UiFileNew` | |
| `UiFileOpen` | `UiFileOpen` | |
| `UiFileOpenURL` | `UiFileOpenURL` | |
| `UiFileSave` | `UiFileSave` | |
| `UiFileSaveAs` | `UiFileSaveAs` | |
| `UiFileDownload` | `UiFileDownload` | |
| `UiFileExportViewer` | `UiFileExportViewer` | |
| `UiFilePrint` | `UiFilePrint` | |
| `UiFilePageSetup` | `UiFilePageSetup` | |
| `UiEditProperties` | `UiEditProperties` | |
| `UiClipFromScreenshot` | `UiClipFromScreenshot` | |
| `UiClipFromScreenshotPaste` | `UiClipFromScreenshotPaste` | |
| `UiPasteFromMonitor` | `UiPasteFromMonitor` | |
| `UiImageCanvasSize` | `UiImageCanvasSize` | |
| `UiImageResize` | `UiImageResize` | |
| `UiImageRotateCustom` | `UiImageRotateCustom` | |
| `UiImageSkew` | `UiImageSkew` | |
| `UiImageOffset` | `UiImageOffset` | |
| `UiImageTile` | `UiImageTile` | |
| `UiImageCropAndFit` | `UiImageCropAndFit` | |
| `UiImagePixelArtUpscale` | `UiImagePixelArtUpscale` | |
| `UiImageGenerateIconVariants` | `UiImageGenerateIconVariants` | |
| `UiImageSpritesheetToLayers` | `UiImageSpritesheetToLayers` | |
| `UiImageLayersToSpritesheet` | `UiImageLayersToSpritesheet` | |
| `UiActiveLayerProperties` | `UiActiveLayerProperties` | |
| `UiRenameActiveLayer` | `UiRenameActiveLayer` | |
| `UiSetAllLayerProperties` | `UiSetAllLayerProperties` | |
| `UiColorLutEditor` | `UiColorLutEditor` | |
| `UiColorMatrix` | `UiColorMatrix` | |
| `UiColorPickChannels` | `UiColorPickChannels` | |
| `UiColorCount` | `UiColorCount` | |
| `UiColorIndexedPalette` | `UiColorIndexedPalette` | |
| `UiColorReduceColorDepth` | `UiColorReduceColorDepth` | |
| `UiColorSwatchesFromImage` | `UiColorSwatchesFromImage` | |
| `UiPaletteEditProperties` | `UiPaletteEditProperties` | |
| `UiSetAnimationSpeed` | `UiSetAnimationSpeed` | |
| `UiSetAllFrameDelay` | `UiSetAllFrameDelay` | |
| `UiSetAllFrameDisposal` | `UiSetAllFrameDisposal` | |
| `UiAnimationSpin` | `UiAnimationSpin` | |
| `UiAnimationCrossfade` | `UiAnimationCrossfade` | |
| `UiFilterGallery` | `UiFilterGallery` | |
| `UiScriptEditor` | `UiScriptEditor` | |
| `UiFormatFont` | `UiFormatFont` | |
| `UiPromptText` | `UiPromptText` | |
| `UiToggleFullScreen` | `UiToggleFullScreen` | |
| `UiDocumentRecovery` | `UiDocumentRecovery` | |
| `UiCheckForUpdates` | `UiCheckForUpdates` | |
| `UiShowReleaseNotes` | `UiShowReleaseNotes` | |
| `UiHelpContents` | `UiHelpContents` | |
| `UiHelpAbout` | `UiHelpAbout` | |
| `UiFeedbackForm` | `UiFeedbackForm` | |
| `UiShowConfigDialogSingle` | `UiShowConfigDialogSingle <ConfigName>` | |
## Value lists
Canonical values for the enumerated parameters above. Values are matched
**case-insensitively**, and many also accept **synonyms** (see below); the
canonical names listed here always work.
**DrawingTool**
`Pointer` � `Move` � `RectangularSelect` � `Hand` � `FreeformSelect` � `Zoom` � `MagicWand` � `Gradient` � `Eyedropper` � `Fill` � `Pencil` � `Eraser` � `Airbrush` � `FilterTool` � `Line` � `Warp` � `BasicRectangle` � `RoundedRectangle` � `Ellipse` � `Polygon` � `Text` � `Bezier` � `Clone` � `TextureBrush` � `Brush` � `CustomBrush`
**PaintCursor**
`Default` � `Cross` � `Drag` � `HandFlat` � `HandDrag` � `Zoom` � `Unavailable` � `Move` � `Custom`
**InternalFilter**
`BlackAndWhite` � `Invert` � `Brighten` � `Highlight` � `Darken` � `Smoke` � `Diffuse` � `Blur` � `Emboss` � `Grayscale` � `Desaturate` � `ColorSwap` � `RedEyeRemoval` � `Sharpen` � `Wave` � `BaseRGB` � `Recolor` � `Noise` � `Speckle` � `Solarize` � `Posterize` � `TwoTone` � `GraphicPen` � `FrostedGlass` � `Rain` � `BitwiseAND` � `BitwiseOR` � `BitwiseXOR` � `BitwiseEQV` � `BitwiseIMP1` � `BitwiseIMP2` � `Plaid` � `SetTransparentColor` � `ColorToAlpha` � `MaskColorize` � `Addition` � `Subtraction` � `Multiplication` � `Opacify`
**ObjectMoveType**
`Left` � `Right` � `Top` � `Bottom` � `Center` � `CenterHorizontal` � `CenterVertical` � `OriginCanvas` � `OriginLayer` � `OriginViewport` � `PushLeft` � `PushRight` � `PushAbove` � `PushBelow`
**SelectionRefineType**
`FillWidth` � `FillHeight` � `FillLeft` � `FillRight` � `FillUp` � `FillDown` � `Expand` � `Shrink`
**ContentAlignment**
`TopLeft` � `TopCenter` � `TopRight` � `MiddleLeft` � `MiddleCenter` � `MiddleRight` � `BottomLeft` � `BottomCenter` � `BottomRight`
**CropFitTarget**
`Selection` � `ActiveLayer` � `AllLayers` � `Canvas`
**CropFitSource**
`Selection` � `Content` � `CanvasBoundsCropOnly` � `CanvasBoundsFit` � `AllLayerContent` � `AllLayerBounds`
**ActiveLayerBlendingMode**
`Normal` � `Dissolve` � `Keyed` � `Multiply` � `Screen` � `Overlay` � `HardLight` � `SoftLight` � `HardMix` � `ColorDodge` � `ColorBurn` � `Add` � `Subtract` � `Divide` � `Difference` � `Exclusion` � `LightenOnly` � `DarkenOnly` � `LighterColor` � `DarkerColor` � `BitwiseAND` � `BitwiseOR` � `BitwiseXOR` � `BitwiseXNOR` � `BitwiseOverIMPBase` � `BitwiseBaseIMPOver` � `HSLHue` � `HSLSaturation` � `HSLColor` � `HSLLightness` � `HSLRollHue` � `RGBRed` � `RGBGreen` � `RGBBlue` � `RGBAverage`
**ActiveLayerColorMode**
`TrueColor` � `HighColor` � `WebSafe` � `Grayscale` � `Bitmap` � `Indexed` � `Palette`
**ActiveLayerTransparencyMode**
`AlphaChannel` � `AlphaBit` � `TransparentColor` � `None`
**AirbrushShape**
`SquareNoise` � `RoundNoise` � `SquareSmooth` � `RoundSmooth`
**BrushShape**
`FilledSquare` � `FilledCircle` � `HollowSquare` � `HollowCircle` � `StraightCross` � `DiagonalCross` � `CaligraphyNE` � `CaligraphyNW` � `HorizontalLine` � `VerticalLine`
**BucketFillMode**
`All` � `Contiguous` � `Bounded` � `Inverse`
**EyedropperScope**
`ActiveLayer` � `AllLayers` � `Screen`
**ShapeFillMode**
`BorderFill` � `BorderOnly` � `FillOnly`
**TextBackground**
`Transparent` � `Solid` � `Rounded` � `AverageColor` � `Blur`
**TextEffect**
`None` � `Outline` � `Sponge` � `Shadow` � `SimpleShadow` � `Glow` � `GradientH` � `GradientV`
**TextFontStyle**
`Bold` � `Italic` � `Underline` � `Strikeout` � `Bold Italic` � `Bold Underline` � `Bold Strikeout` � `Bold Italic Underline` � `Bold Italic Strikeout` � `Italic Underline` � `Italic Strikeout` � `Italic Underline Strikeout` � `Underline Strikeout` � `Bold Italic Underline Strikeout`
**TransparencyEditingMode**
`Alpha` � `Keyed` � `Opaque`
### Synonyms
Alternate spellings accepted on input (case-insensitive), grouped by the
canonical value they resolve to. Prefer canonical names when generating scripts;
these are for reading existing scripts and for accepting looser input.
- **DrawingTool**: `tbairbrush` ? **Airbrush** � `rectangle`, `tbbasicrectangle` ? **BasicRectangle** � `tbbezier` ? **Bezier** � `tbbrush` ? **Brush** � `tbclone` ? **Clone** � `tbcustombrush` ? **CustomBrush** � `tbellipse` ? **Ellipse** � `tberaser` ? **Eraser** � `tbeyedropper` ? **Eyedropper** � `bucketfill`, `tbbucketfill`, `tbfill` ? **Fill** � `tbfiltertool` ? **FilterTool** � `tbfreeformselect` ? **FreeformSelect** � `tbgradient` ? **Gradient** � `tbhand` ? **Hand** � `tbline` ? **Line** � `tbmagicwand` ? **MagicWand** � `tbmove` ? **Move** � `tbpencil` ? **Pencil** � `tbpointer` ? **Pointer** � `tbpolygon` ? **Polygon** � `tbrectangularselect` ? **RectangularSelect** � `tbroundedrectangle` ? **RoundedRectangle** � `tbtext` ? **Text** � `tbtexturebrush` ? **TextureBrush** � `tbwarp` ? **Warp** � `tbzoom` ? **Zoom**
- **AirbrushShape**: `round` ? **RoundNoise** � `smoothcircle` ? **RoundSmooth** � `smoothsquare`, `square`, `squaresmooth` ? **SquareNoise**
- **LayerBlendingMode**: `alpha` ? **Normal**
- **LayerColorMode**: `argb`, `full` ? **TrueColor**
- **CropFitSource**: `selectionbounds` ? **Selection**
## Command index
`Abort` � `Add` � `AddLayer` � `AddLayerMask` � `Alert` � `AnimationGenerateFullFrames` � `AnimationNextFrame` � `AnimationPause` � `AnimationPlay` � `AnimationPlayOnceAndWait` � `AnimationPrevFrame` � `AnimationReset` � `AnimationSpin` � `Append` � `ApplyFilter` � `ApplyLUT` � `BeginDraw` � `BeginStep` � `CanvasSize` � `ClearBezier` � `ClearImage` � `ClearSelection` � `ClearStatus` � `CloseAllMenus` � `CloseDocument` � `CloseLayerList` � `CombineMask` � `CommitAutosave` � `CommitSettings` � `ComposeLayer` � `Copy` � `CopyActiveLayerToClipboard` � `CopyMerged` � `CopySettingsToAllInstances` � `CropFit` � `CropToContent` � `CropToSelection` � `Cut` � `DecomposeLayer` � `Delete` � `DeleteLayer` � `Deselect` � `DragCancel` � `Draw` � `DuplicateLayer` � `Emit` � `EndDraw` � `EndStep` � `ExecScript` � `Exit` � `ExplainTool` � `FindNext` � `FitToCanvas` � `FlattenImage` � `Flip` � `ForEach` � `If` � `Increment` � `InvertColors` � `InvertSelection` � `LayerLocked` � `LayerVisibility` � `LoadClassicPalette` � `LoadSelection` � `LoadSetting` � `LoadSwatches` � `Log` � `LogError` � `LogInfo` � `LogMemory` � `LogWarning` � `MakeOpaque` � `MarkClean` � `MarkDirty` � `MaskToLayer` � `MeasureText` � `MergeDown` � `MergeVisible` � `MoveObject` � `Multiply` � `NewDocument` � `NewInstance` � `Offset` � `OpenDocument` � `OpenDocumentMRU` � `OpenLayerList` � `Paste` � `PasteAsNewImage` � `PickChannels` � `PlaceBezier` � `PlaceSelection` � `PlaceText` � `Pop` � `Prompt` � `PromptAction` � `PromptBoolean` � `PromptColor` � `PromptFileOpen` � `PromptFileSave` � `PurgeUndo` � `Push` � `Randomize` � `RasterizeText` � `Redo` � `RefineSelection` � `Refresh` � `ReloadSettings` � `RenameActiveLayer` � `Repeat` � `RequireHeadroom` � `Resize` � `Rotate` � `Round` � `Save` � `SaveCopy` � `SaveSetting` � `SaveSettings` � `Scope` � `Select` � `SelectAll` � `SelectAllContent` � `SelectCopy` � `SelectionToLayer` � `SetAllFrameDelay` � `SetAllFrameDisposal` � `SetAverageColor` � `SetCursor` � `SetGlobalColorMode` � `SetTool` � `Skew` � `Sleep` � `SwapAlphaMask` � `Tile` � `UiActiveLayerProperties` � `UiAnimationCrossfade` � `UiAnimationSpin` � `UiCheckForUpdates` � `UiClipFromScreenshot` � `UiClipFromScreenshotPaste` � `UiColorCount` � `UiColorIndexedPalette` � `UiColorLutEditor` � `UiColorMatrix` � `UiColorPickChannels` � `UiColorReduceColorDepth` � `UiColorSwatchesFromImage` � `UiDocumentRecovery` � `UiEditProperties` � `UiFeedbackForm` � `UiFileDownload` � `UiFileExportViewer` � `UiFileNew` � `UiFileOpen` � `UiFileOpenURL` � `UiFilePageSetup` � `UiFilePrint` � `UiFileSave` � `UiFileSaveAs` � `UiFilterGallery` � `UiFormatFont` � `UiHelpAbout` � `UiHelpContents` � `UiImageCanvasSize` � `UiImageCropAndFit` � `UiImageGenerateIconVariants` � `UiImageLayersToSpritesheet` � `UiImageOffset` � `UiImagePixelArtUpscale` � `UiImageResize` � `UiImageRotateCustom` � `UiImageSkew` � `UiImageSpritesheetToLayers` � `UiImageTile` � `UiPaletteEditProperties` � `UiPasteFromMonitor` � `UiPromptText` � `UiRenameActiveLayer` � `UiScriptEditor` � `UiSetAllFrameDelay` � `UiSetAllFrameDisposal` � `UiSetAllLayerProperties` � `UiSetAnimationSpeed` � `UiShowConfigDialogSingle` � `UiShowReleaseNotes` � `UiToggleFullScreen` � `Undo` � `UpdateStatus`
## Worked examples
### Prompt and branch
```npss
Prompt VarName "Enter Yes or something else"
If $VarName = "Yes"
Alert "You entered Yes"
EndIf
If $VarName = ""
Alert "You canceled the dialog"
EndIf
```
### Accumulate in a loop
```npss
Set Total=0
Repeat 5
Add Total $LOOP_ITER
EndRepeat
Alert "Sum of 0..4 = $Total"
```
### Dim every layer, restoring state
```npss
Scope Document
ForEach Layer
Set ActiveLayerOpacity=50
EndForEach
```
### A self-contained drawing step
```npss
Scope Document
Push DrawingTool ShapeFillMode LineWidth
Set DrawingTool=Rectangle
Set ShapeFillMode=FillOnly
Set LineWidth=1
BeginStep "Fill quarter"
Push BackColor
Set BackColor=$ForeColor
Draw 0% 0% 50% 50%
Pop BackColor
EndStep
Pop DrawingTool ShapeFillMode LineWidth
```