set display mode 1600,1200,32
sync on : sync rate 85
load image "w.jpg",4
REM create a memblock from the image
make memblock from image 1, 4
REM get the image's width and height
width = memblock dword(1,0)
height = memblock dword(1,4)
for x = 1 to width/2
for y = 1 to height
location = ((y-1)*width + x - 1)*4 + 12
B = memblock byte(1,location)
G = memblock byte(1,location+1)
R = memblock byte(1,location+2)
A = memblock byte(1, location+3)
REM set each pixel in the image to a random color
write memblock dword 1, location, rgb(R+rnd(255),G,B)
next y
next x
REM create a new image from the memblock data
make image from memblock 3, 1
REM display the new image
repeat
sprite 1,mousex(), mousey(), 4
sprite 2,mousex()+width+5, mousey(), 3
sync
until spacekey()