2016-03-26 00:47:20 +01:00
# Set Pixel
2016-04-02 01:22:47 +02:00
The set pixel function. #set pixel.
2016-03-26 00:47:20 +01:00
2016-04-13 17:27:45 +02:00
Set the on/off state of pixel in an [Image ](/reference/image/image ).
2016-03-26 00:47:20 +01:00
### KindScript
```
export function setPixel(_this: micro_bit.Image, x: number, y: number, value: boolean)
```
### Parameters
2016-04-13 17:27:45 +02:00
* x - [Number ](/reference/types/number ); the *x coordinate* or horizontal position of a pixel in an [image ](/reference/image/image )
* x - [Number ](/reference/types/number ); the *y coordinate* or vertical position of a pixel in an [image ](/reference/image/image )
* value -[Boolean](/reference/types/boolean); the on/off state of a pixel; `true` for on, `false` for off
2016-03-26 00:47:20 +01:00
### x, y coordinates?
2016-04-13 17:27:45 +02:00
To figure out the ``x``, ``y`` coordinates, see [LED screen ](/device/screen ).
2016-03-26 00:47:20 +01:00
### Example
The following example creates an image and stores it in the `img` variable. The `set pixel` function sets the centre pixel off, before `img` is shown using `show image` .
```
let img = images.createImage(`
. . # . .
. # . # .
. . # . .
. # . # .
. . # . .
`)
img.setPixel(2, 2, false)
img.showImage(0)
```
### See also
2016-04-13 17:27:45 +02:00
[pixel ](/reference/images/pixel ), [show image ](/reference/images/show-image ), [image ](/reference/image/image ), [create image ](/reference/images/create-image ), [scroll image ](/reference/images/scroll-image )
2016-03-26 00:47:20 +01:00