> For the complete documentation index, see [llms.txt](https://learnpython.strivemath.com/p5-python-web/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learnpython.strivemath.com/p5-python-web/reference/images-and-audio/loadimage-and-image.md).

# loadImage() and image()

### Example

<figure><img src="/files/X5oBzRZheDOLQCBtu7Cl" alt=""><figcaption></figcaption></figure>

```python
def setup():
    ...
    loadImage("http://donkeyImage.png",'donkey')

def draw():
    ...
    image(assets['donkey'],50,50,300,300)
```

### Syntax

```python
def setup():
    ...
    loadImage("sourceURL",'NAME')

def draw():
    ...
    image(assets['NAME'],x,y,w,h)
```

| Input     | Description                                  |
| --------- | -------------------------------------------- |
| sourceURL | web or local URL of **image** to be loaded   |
| NAME      | name for **variable** of image in code       |
| x         | x co-ordinate of bottom left corner of image |
| y         | y co-ordinate of bottom left corner of image |
| w         | width of image                               |
| h         | height of image                              |

### Description

Loads an image into memory from an external source so that it can be used in code. The **sourceURL** can be a web address (for example **"<http://donkeyImage.png>"**) - this is the usual situation - or the local address if the file is stored with the rest of your code.&#x20;

Once an image is loaded, **image(assets\['NAME'], x, y, w, h)** can be called to draw the image at position **(x, y)** with width **w** and height **h**

{% hint style="info" %}
Find these documents helpful? Let the people who made them help your child learn to code at [**Strivemath**](https://www.strivemath.com/)<mark style="color:blue;">**!**</mark>

We'd love to hear your Feedback/Comments [here](https://docs.google.com/forms/d/e/1FAIpQLSeqorBAGTya-YBRI-VFjJxtgQtCz3ucGDI96K96sNyuaGuvdw/viewform?usp=sf_link).
{% endhint %}
