#define cimg_debug 0

#include "CImg.h"
#include <ctype.h>
#include <valarray>
#include <assert.h>
#include <math.h>
#if ( defined(_MSC_VER) && _MSC_VER<=1200 ) || defined(__DMC__)
#define std
#endif

using namespace cimg_library;

int main(int argc,char **argv) {
	int i;
	if (argc<2) return 0;
	CImgList<> imgl;
	CImg<> img0(argv[1]);
	imgl.insert(img0);
	printf("%s\n", argv[1]);
	for (i=2; i<argc; i++) {
		CImg<> img(argv[i]);
		if (!img0.is_sameXY(img)) {
			printf("%s not in the same size\n", argv[i]);
			return 0;
		}
		img /= img.mean();
		imgl.insert(img);
		printf("%s\n", argv[i]);
	}

	imgl.save_cimg("out.imgl");
	return 0;
}

