Hello,

I am trying to use Imagej for my thesis. I have few sets of five photographs (black and white), I would like to make an average of every five photographs. I wrote a simple macro (code below) to do this, but I was not sure whether the output is correct. So I made a histogram for every single photography and made an average value of Mean grey value (using handheld calculator), I was surprised, when I found out, that the Mean grey value in histogram of averaged photo was different. To exclude possible mistake in my algorithm I tried the Grouped Z Projection, the histogram Mean grey value was again completely different value. To exclude possible problem of Imagej I tried GraphicsMagick (`gm convert -average`

), then I made histogram with another different Mean grey value.

I thank in advance for any help, especially help to explain all these different values:

Mean1:76,963

Mean2:77,055

Mean3:76,802

Mean4:76,802

Mean5:76,659

AVGMean(calculator):76,8562

AVGMean(graphicsmagick):76.434

AVGMean(GroupedZProjection):76,443

AVGMean(MyAlgorithm):76,636

My code:

```
input = "/home/user/Documents/Thesis/IRPHOTO/input/";
output = "/home/user/Documents/Thesis/IRPHOTO/output/";
setBatchMode(true);
list = getFileList(input);
i=0;
open(input + list[i]);
id1 = getImageID;
j = i + 1;
open(input + list[j]);
id2 = getImageID;
k = i + 2;
open(input + list[k]);
id3 = getImageID;
l = i + 3;
open(input + list[l]);
id4 = getImageID;
m = i + 4;
open(input + list[m]);
id5 = getImageID;
id1=(id1 + id2 + id3 + id4 + id5)/5;
i = i + 50;
saveAs("Jpeg", output + i);
close();
setBatchMode(false);
```