You can't just work on the values of the pixels directly - those contain the values of R, G, and B all in one pixel. You need to do the averaging separately for the R, G and B components of each pixel. Something like
Joined: Mar 22, 2005
Um, did you just edit your post all out of context?
Joined: Nov 02, 2012
Yeah, sorry about that. I figured out what I was doing wrong, had another question, and thought I could edit it before anyone responded. Sorry for the confusion. Thanks for the help btw.