Command Reference: FILTER.* Command Family
About the FILTER.* Commands
The FILTER. family of commands give your scripts access to the many filters and effects included in Mike's Sprite Editor. These commands are the focus of the scripting engine, as they allow you to create an easily repeatable series of filters - custom effects that you can use over and over again.
There are just two things to keep in mind about these commands. Firstly, the order of their parameters is designed so that they mirror the order of the options on the filter's dialog. See this page for an example.
Secondly, commands often use a shorter nickname than the filter they represent. For example, the "Change Foreground to Background Color" filter's command is FILTER.SWAP . This might make it a little tricky to remember which command goes with which filter, but hopefully the pair make enough sense.
The FILTER.* Commands
FILTER.ADJUST Red Green Blue [affect_white]
This command represents the Adjust Color Channels filter. The first three parameters are the values of the red, green, and blue color channels, expressed as a percentage (eg, 125 means 125% of the original value). These are expected to be between 0 and 200, inclusive.
The final parameter is optional, and if given a non-zero value, the changes will affect pure white as well as everything else.
FILTER.BLUR Passes
The Blur filter blurs the image. You need at least one pass to blur the image, and every pass beyond that makes the image even more blurry. There are diminishing returns though, so four passes is generally the limit.
FILTER.BLURCOLOR Passes [Color]
This uses the Blur Foreground Color to blur just a selection of pixels. You can choose the color to affect by providing it as the second parameter.
FILTER.BRIGHTEN Bright Middle Dark
This applies the Brighten / Darken filter to the image, adding or subtracting from each pixel's color value depending on how bright it is. Expected values for each parameter are between -200 and 200, inclusive. Values beyond -255 and 255 may result in bizarre outcomes.
FILTER.CYCLE
This cycles the color palette of your image by one step. Only colors in your current palette are affected. When run from the command line, this uses your default palette's colors.
FILTER.DARKEN_ROWS [Size]
The Darken Every Other Row filter is fairly self-explanatory; every other row will become slightly darker. The optional size parameter determines how many pixels high your rows are. If omitted, rows are assumed to be 1 pixel high.
FILTER.GRAYSCALE
This command turns the entire image into a grayscale version of itself.
FILTER.GROW [Color]
Normally, the Grow Foreground Color filter uses the current foreground color. However, you can specify the color to grow by passing it as the first parameter.
FILTER.HALFTONE Method [ColorA] [ColorB]
The Halftone filter changes your image into a series of dots using one of four methods. To indicate which method you want to use, set the first parameter to a number between 0 and 3, inclusive. These stand for the different options, as follows:
0 - Three Color Halftone
1 - Four Color Halftone
2 - Black and White Halftone
3 - Foreground/Background Color Halftone with black outlines
You also have the option to specify which colors to use as the Foreground / Background colors. Just pass their colors to this command as the second and third parameters.
FILTER.INVERT
Inverts the colors of the image.
FILTER.MINMAX Method
Alters the image using the RGB Min/Max filter. To indicate which method you want to use, provide a number between 0 and 3 as the first parameter. These stand for the following options:
0 - Keep Max Channels
1 - Keep Min Channels
2 - Discard Max Channels
3 - Discard Min Channels
FILTER.MONOCHROME Threshold
This changes the image into pure black and white, depending on the average value of each pixel. Average color values above or equal to the Threshold are turned white, while all other colors are assigned black.
FILTER.NOISE Method Level Opacity
Adds noise to the current image. The Level parameter specifies how much noise is added, while the Opacity parameter specifies how transparent the noise is on a scale between 0 (completely transparent) and 100 (completely opaque). Your options for the Method parameter are:
0 = Static
1 = Colored Static
2 = Melting
FILTER.PIXELATE Size
Pixelates the image. The Size parameter determines how large the new pixels are. Expected values are between 2 and 30, but there really isn't an upper limit here.
FILTER.RECOLOR Color [affect_white]
This recolors the image using the provided color. If the second parameter is present and does not equal zero, then pure white areas will be altered as well.
FILTER.REDUCE Amount
This attempts to reduce the number of colors in your image by dividing/multiplying each pixel's color channels by Amount. The exact result is unpredictable.
FILTER.SHARPEN Strength
Applies the Sharpen Filter, using the given strength.
FILTER.SHIFTRGB Offset
This alters the image by separating the color channels and re-integrating them at an offset. If the given offset is positive, the blue channel is pushed to the left and the red channel to the right. Otherwise, the red channel is moved left and the blue channel moved right.
FILTER.SWAP [ColorA ColorB]
This exchanges one color for another. By default, this uses the current Foreground and Background colors, but you can specify which colors to use. Hint: use .ALPHA to change transparent pixels or turn something transparent.
FILTER.TINT Color Strength Method
This tints the image. The Strength parameter determines how strongly the new color tints the image, while the optional third parameter controls whether or not black and white are tinted. Your options for the third parameter are:
0 - Tint Everything
1 - Leave pure black alone
2 - Leave pure white alone
3 - Leave both pure black and pure white alone.
FILTER.TO_PALETTE [ignore_gray]
This filter attempts to translate the colors in your image into the colors provided by your current palette. Since gray colors can sometimes overwhelm the result, you can disable them by setting the optional first parameter to a non-zero value.