Read our Image API guide for an explanation of these blocks.
Set whether Image API output is scaled automatically. This is set to true
by default. This setting affects how all the blocks below work.
When this is enabled, the coordinates and dimensions passed to all Image API blocks will be scaled by Engine.SCALE
. By settings this to false, you can use the Image API blocks to manipulate images on a per-pixel basis, no matter how your game is upscaled.
imageApiAutoscale = true;
imageApiAutoscale = false;
Create a blank image of the specified width and height. Usually assigned to an Image attribute right away.
newImage([INT], [INT])
Returns a copy of the specified image. This is a true copy, so altering the copy will not affect the original.
[IMAGE].clone()
Returns the specified part of the image as a new image.
getSubImage([IMAGE], [INT], [INT], [INT], [INT])
Returns a larger (or smaller) copy of the image. Width and height are given as percentages - 100% means keep it the same, 200% means double, 50% means half.
//Smoothing
resizeImage([IMAGE], ([NUMBER]/100), ([NUMBER]/100), true)
//No Smoothing
resizeImage([IMAGE], ([NUMBER]/100), ([NUMBER]/100), false)
Captures the current screen as an image and returns that. This takes time (it may pause the game for a a tenth of a second), so use it sparingly.
captureScreenshot()
Returns the current image for the specified actor. (In other words, the exact visual state of the actor at the time that you use this.)
getImageForActor([ACTOR])
Returns an image that is loaded from a file. Images must be placed into the extras subfolder of your game. Some blocks require the images to be saved with transparency enabled to work properly.
getExternalImage([TEXT])
Returns an image that is loaded from a URL. When the image successfully loads, the enclosed blocks will run. Use the embedded the image
block to refer to the loaded image. If the image does not load, the enclosed blocks will not run.
For a Flash game you may need to give permissions to access the web.
loadImageFromURL([TEXT], function(img:BitmapData):Void {
[ACTIONS]
});
Converts an image into text form and returns that. Useful for storing image data on servers (via an HTTP request). This takes time to run (a split second or longer).
imageToText([IMAGE])
Returns an image that was converted to text using the prior block. This takes time to run (a split second or longer).
imageFromText([TEXT])