Microsoft Small Basic

Program Listing: GVQ029
' Create an Array of luminance data
pic=ImageList.LoadImage("C:\picPATH")
h = ImageList.GetHeightOfImage(pic)
w = ImageList.GetWidthOfImage(pic)
GraphicsWindow.DrawImage(pic,0,0)
quot = Text.GetCharacter(34)
For i = 1 To 100
total=""
for a = 1 To 100
x=(w/100)*a
y=(h/100)*i

pix = GraphicsWindow.GetPixel(x,y)
hexi=text.GetSubText(pix,2,6)
'____________________Converting Hexidecimal to RGB___________'
hexchar1 = Text.GetSubText(hexi,1,1)
hexchar2 = Text.GetSubText(hexi,2,1)
hexchag1 = Text.GetSubText(hexi,3,1)
hexchag2 = Text.GetSubText(hexi,4,1)
hexchab1 = Text.GetSubText(hexi,5,1)
hexchab2 = Text.GetSubText(hexi,6,1)
hcol[1] = 1
hcol[2] = 2
hcol[3] = 3
hcol[4] = 4
hcol[5] = 5
hcol[6] = 6
hcol[7] = 7
hcol[8] = 8
hcol[9] = 9
hcol["A"] = 10
hcol["B"] = 11
hcol["C"] = 12
hcol["D"] = 13
hcol["E"] = 14
hcol["F"] = 15
rval = (hcol[hexchar1]*16)+hcol[hexchar2]
gval = (hcol[hexchag1]*16)+hcol[hexchag2]
bval = (hcol[hexchab1]*16)+hcol[hexchab2]
'_______________CONVERTING_RGB_TO_LUMINANCE______'
lumin = Math.SquareRoot(((rval*rval)*0.3)+((gval*gval)*0.59)+((bval*bval)*0.11))
lumr = Math.Round(lumin)
total=total+lumr+";"
EndFor
' The following line could be harmful and has been automatically commented.
' File.WriteLine("C:\pathout.txt",i,"Waves["+i+"]="+quot+total+quot)
EndFor