// ResizeImagesAndStack
// G. Landini @ bham. ac. uk
// Takes a number of images and resizes them
// according to the largest one and makes a stack 

macro "Resize Images And Stack" {
    w = 0;
    h = 0;

    // generate test images
    //for (i=1; i<=10; i++)
   //     newImage(""+i, "8-bit ramp", 100+50*i, 100+50*i, 1);

    setBatchMode(true);
    for (i=1; i<=nImages; i++) {
	    selectImage(i);
	    if (getWidth>w) w=getWidth;
	    if (getHeight>h) h=getHeight;
    }

    for (i=1; i<=nImages; i++) {
        selectImage(i);
        run("Canvas Size...", "width="+w+" height="+h+" position=Top-Left");
    }
    run("Convert Images to Stack");
    setBatchMode(false);
}

