Using the data storage type defined on this page for raster images, write the image to a PPM file (binary P6 prefered).

(Read the definition of PPM file on Wikipedia.)




clear screen
 
wid = 150 : hei = 200
open window wid, hei
window origin "cc"
color 255, 0, 0
fill circle 0, 0, 50
color 0, 255, 0
fill circle 0, 0, 35
color 0, 0, 255
fill circle 0, 0, 20
window origin "lt"
 
header$ = "P6\n" + str$(wid) + " " + str$(hei) + "\n255\n"
 
fn = open("exmaple.PPM", "wb")
 
print #fn header$
 
for x = 0 to hei - 1
	for y = 0 to wid - 1
		c$ = right$(getbit$(y, x, y, x), 6)
		poke #fn, dec(left$(c$, 2))
		poke #fn, dec(right$(c$, 2))
		poke #fn, dec(mid$(c$, 3, 2))
	next y
next x
 
poke #fn, asc("\n")
close #fn