Scribbler

This program is an attempt to "paintify" an input image.

The idea is to take random walks on an image. The walk starts at a randomly chosen pixel. This pixel's color will be the color in which the walk is painted. The walk lasts as long as the pixels of the original image have colors that do not differ too much from the color of the walk. Once the walk reaches a pixel that is of signifigantly different color, the walk ends, and a new one starts.

The process repeats indefinitely, but can be stopped at any time and the image saved.

The right image is the result of processing the left image with the code below.

file$ = open preview dialog$
get quicktime pict size file$,picW,picH

resize console 20,50,picW+20,picH+50
 load quicktime pict file$

virtu = init screen (0,0,picW+0,picH+0)
set screen to virtu
cls
copyrect 0,0,picW,picH,0,0,picW,picH,0,0,virtu

set screen to console
cls

rem threshFact controls how long each walk lasts; 
rem larger values result in longer walks and a fuzzier resulting image

threshFact=0.1
step=1.0
pi=3.1415926536

loopMain:

loopTilBlack:

x=rnd*picW: y=rnd*picH
set screen to console
get pixel x,y,redt,greent,bluet

if ((redt+greent+bluet)>0) then goto loopTilBlack

set screen to virtu
get pixel x,y,redt,greent,bluet

fail=0

loop1:

set screen to virtu
get pixel x,y,red,green,blue

set screen to console
forecolor redt,greent,bluet

plot x,y

direc = rnd*2*pi

x=(x+cos(direc)*step) 
if ((x<0) or (x>picW)) then fail=1
y=(y+sin(direc)*step) 
if ((y<0) or (y>picH)) then fail=1

cd=(red-redt)^2+(green=greent)^2+(blue-bluet)^2
if cd>(65535*65535)*threshFact then fail=1

if (fail=0) then goto loop1

goto loopMain



back