I am creating a 'mean' image using getpixel and setpixel from 5 images. The images are in jpg format. I'm using an array with 2 loops to go through every pixel on the image. When I use an array on just one image getpixel and then setpixel on another image it turns out fine.

BUT, when I use the getpixel on multiple images creating mean pixels and putting these on a new image, I get a bunch of different colors on my image and it isn't clear... Even though there is no color on my 5 images which I am using to create the mean.

The images that I'm using for this are in gray scale. I'm using a long for the getpixel and it looks like it is reading this in from the jpg in 24 bit, I think?? When I check the program the mean pixel is being computed correctly.

Any ideas on what I need to change? Should these images read in as 256 scale? That is what I thought they would be, but they are reading in values in the millions. When I try to convert this long to grey scale I get the images in red only. Not sure what is going on, any help appreciated. Sorry I don't have the code at home, just trying to figure out what needs to be done. can post sample code tomorrow if that helps.