RosettaCodeData/Task/Grayscale-image/BASIC256/grayscale-image.basic

24 lines
375 B
Plaintext

w = 143
h = 188
name$ = "Mona_Lisa.jpg"
graphsize w,h
imgload w/2, h/2, name$
fastgraphics
for x = 0 to w-1
for y = 0 to h-1
p = pixel(x,y)
b = p % 256
p = p \256
g = p % 256
p = p \ 256
r = p % 256
l = 0.2126*r + 0.7152*g + 0.0722*b
color rgb(l,l,l)
plot x,y
next y
refresh
next x
imgsave "Grey_"+name$,"jpg"