pixelAveragingTest.frink

Download or view pixelAveragingTest.frink in plain text format


// Test of averaging pixel values.

i = new image["http://futureboy.us/images/futureboydomethumb4.gif"]

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[]


Download or view 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 19920 days, 15 hours, 25 minutes ago.