# applyImage

```lua
return function()
    wait(2);
    local app = getApp();
    local ob = app.createGameObject(); --create object to attach images to
    applyImage(ob, 'welcomeImage'); --add the image titled 'welcome' to the object
    ob.image.anchor('bottom left', true); --anchors the image to the bottom left... accounting for image dimensions = true
    waitForAnimation(ob.image); --pauses script until finished...
    wait(2);
    applyImage(ob, 'byeImage');
    waitForAnimation(ob.image);
    log('finished playing two animations!');
end
```

{% hint style="info" %}
You must first create an image for it to be used in applyImage()
{% endhint %}

To create an image for the script to use, go back into Bot Commands > under advanced select the Images option button, then click "Create New".

<div><figure><img src="https://2994430787-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYvA0UlM6GCcOd8hKhafT%2Fuploads%2FIkymOMeKzUh9Kl7TqfUr%2Fsfiprl4h8B.png?alt=media&#x26;token=7a8f6b5a-ec43-49e0-a2a2-d7c60a524038" alt=""><figcaption></figcaption></figure> <figure><img src="https://2994430787-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYvA0UlM6GCcOd8hKhafT%2Fuploads%2FA40RxbFZyC2M1qp0Zvdq%2FKP4lFQQ0Rv.png?alt=media&#x26;token=4e0e081a-053a-4c36-a0f9-07021ea8c9f5" alt=""><figcaption></figcaption></figure></div>

After creating the image, select a .png sprite-sheet to be uploaded. If your image is animated, set the width and height values to be a single frame of the sprite-sheet. (this also works with gifs but it is less optimized.)

<figure><img src="https://2994430787-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYvA0UlM6GCcOd8hKhafT%2Fuploads%2F8iu8wUYBOCw8qRu0RIad%2FwvMp0RvZpk.png?alt=media&#x26;token=ad968a25-c23b-4253-9973-97d286c62967" alt=""><figcaption></figcaption></figure>
