# 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="/files/Itg4g2BYieacG8Dl5quA" alt=""><figcaption></figcaption></figure> <figure><img src="/files/xUysnljLdPErtHe2r6pY" 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="/files/lhFlxX7RY3umLHVprjtk" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/applyimage.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
