create

Create a pixel image of a certain size.

00create image widthheight
JavaScript
function image.create(width: number, height: number): Image;
Python
def image.create(width: number, height: number): Image

An empty rectangular image is created for the number of pixels wide and high you ask for. Empty means that the image contains all transparent pixels. Pixels colors are set in the image using the image functions.

You can create an zero size image (width = 0 and height = 0) but the function will actually create and image of a default size.

Parameters

  • width: the number of pixels wide (x dimension) for the image.
  • height: the number of pixels high (y dimension) for the image.

Returns

  • an empty (transparent) image of the desired size.

Example

Create a 32 x 32 image and draw an orange border around it.

3232create image widthheighti31orangeBox0iorangeBoxi0orangeBoxi31orangeBox31isetcolor at xytosetcolor at xytosetcolor at xytosetcolor at xytoorangeBoxspriteof kindsetboxSpritetoforfrom 0 todosetorangeBoxtoon start

See also

image