loadImage() and image()
Loads an image into the code's assets
Example

def setup():
...
loadImage("http://donkeyImage.png",'donkey')
def draw():
...
image(assets['donkey'],50,50,300,300)
Syntax
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.
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
Last updated