2016-03-26 00:47:20 +01:00
# Show Image
2016-04-02 01:22:47 +02:00
The show image function.
2016-03-26 00:47:20 +01:00
2016-04-13 17:27:45 +02:00
Show an [Image ](/reference/image/image ) on the [LED screen ](/device/screen ), followed by a 400ms pause.
2016-03-26 00:47:20 +01:00
### Block Editor
![](/static/mb/show-image-0.png)
### KindScript
```
export function showImage(_this: micro_bit.Image, xOffset: number)
```
### Parameters
2016-04-13 17:27:45 +02:00
* x offset - [Number ](/reference/types/number ); the horizontal starting point of an image; use 0 for the first frame of the image, 5 for the second frame of the image, 10 for the third frame and so on.
2016-03-26 00:47:20 +01:00
### Create image and show image
2016-04-13 17:27:45 +02:00
Use the [image editor ](/reference/image/image ) to create images using the [create image ](/reference/image/create-image ) function, and then use `show image` like this:
2016-03-26 00:47:20 +01:00
```
let img = images.createImage(`
. . # . .
. # . # .
. . # . .
. # . # .
. . # . .
`)
img.showImage(0)
```
### Example: display numbers 1-5
2016-04-13 17:27:45 +02:00
The following example creates an image with 5 frames and then uses a [for loop ](/reference/loops/for ) to show each frame on the screen:
2016-03-26 00:47:20 +01:00
```
let img2 = images.createImage(`
. . # . . . # # # # . # # # . . . . # . . # # # .
. # # . . . . . . # . . . # . . . # # . . # . . .
. . # . . . . . # . . . # . . . # # # # . # # # .
. . # . . . . # . . . . . # . . . . # . . . . # .
. . # . . . # # # # . # # # . . . . # . . # # # .
`)
for (let i = 0; i < 5 ; i + + ) {
img2.showImage(i * 5)
basic.pause(1000)
}
```
### Lessons
2016-04-13 17:27:45 +02:00
[rock paper scissors ](/lessons/rock-paper-scissors ), [digital pet ](/lessons/digital-pet ), [offset-image ](/lessons/offset-image )
2016-03-26 00:47:20 +01:00
### See also
2016-04-13 17:27:45 +02:00
[show animation ](/reference/basic/show-animation ), [image ](/reference/image/image ), [create image ](/reference/images/create-image ), [scroll image ](/reference/images/scroll-image )
2016-03-26 00:47:20 +01:00