pixelAveragingTest.frink

View or download pixelAveragingTest.frink in plain text format


// Test of averaging pixel values.

//i = new image["http://futureboy.us/images/futureboydomethumb4.gif"]
i=new image["http://images.wikia.com/openserving/entertainment/images/thumb/f/f1/DanicaMckellar.jpg/350px-DanicaMckellar.jpg"]
w = i.getWidth[]
h = i.getHeight[]

xstep = w/64
ystep = h/64

gr = new graphics
//gr.backgroundColor[0,0,0]
gr.font["Serif", "bold", ystep]

for x=0 to w-xstep step xstep
   for y = 0 to h-ystep step ystep
   {
      [r,g,b,a] = i.averagePixels[x,y,x+xstep, y+ystep]
//      println["$r $g $b $a"]
      gr.color[r,g,b,a]
      gr.fillRectCenter[x,y,xstep,ystep]
//      gr.fillEllipseCenter[x,y,xstep,ystep]
//      gr.text["\u03c0",x,y]
   }

i.show[]
gr.show[]
gr.print[]


View or download pixelAveragingTest.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 17893 days, 18 hours, 52 minutes ago.