Command Reference: IMAGE.* Command Family

About the IMAGE.* Commands

The IMAGE. family of commands manipulate the entire image. Some details about the image, such as its current dimensions, are available via special variables instead of commands.

The IMAGE.* Commands

IMAGE.GETPIXEL X Y
IMAGE.SETPIXEL X Y Color

These commands allow you to set or retrieve a specific pixel's color value. IMAGE.GETPIXEL returns solid black if it's given coordinates outside of the image's dimensions, while IMAGE.SETPIXEL simply does nothing.

 

IMAGE.FLIP [vertical?]

This command allows you to flip the image. If the first parameter is omitted or zero, then it will flip the image horizontally. Otherwise, it flips the image vertically.

 

IMAGE.ROTATE [counterclockwise?]

Similarly, this command rotates the image clockwise if the first parameter ir omitted or zero, counterclockwise otherwise.

 

IMAGE.RESIZE NewWidth NewHeight [OffsetX OffsetY]
IMAGE.SCALE NewWidth NewHeight

These commands change the image's size. Resizing the image only changes the canvas' dimensions, while scaling it stretches it to fit the new size. The IMAGE.RESIZE command also allows you to place the original image at an offset, possibly creating a border or cropping the image. If any new areas are created during the resize operation, they are automatically filled with the current background color.

 

IMAGE.CREATE_MASK [direction]
IMAGE.MERGE_MASKS [direction]

These commands allow you to treat the image as a pair of AND/XOR masks. IMAGE.CREATE_MASK splits the image into these masks, placing the AND mask above the XOR mask unless you specify otherwise. The IMAGE.MERGE_MASKS command does the reverse, combining these masks back into a single image with 1-bit transparency.

Normally, it's fairly obvious where the AND mask is located, as it's always a monochrome image. But, if the entire image is monochrome, IMAGE.MERGE_MASKS won't be able to tell where the AND mask is located. When this happens, it will check for a parameter, and if present, will use that as a guide. If this parameter is not present and IMAGE.MERGE_MASKS can't locate the AND mask automatically, it will throw an error and stop the script.

Both commands allow you to specify where the AND mask should be - just provide one of the following values as the parameter:

0 - Above the XOR Mask
1 - Below the XOR Mask
2 - To the Left of the XOR Mask
3 - To the Right of the XOR Mask

 

IMAGE.TILE Cols Rows

This command copies your image until it has been mirrored enough times to create the given number of columns and rows. You must create at least 1 column and 1 row, otherwise this command will produce an out of range error.

Project Hosted by
Download Mike\'s Sprite Editor