+dir1 = getDirectory("Choose Source Directory ");
+dir2 = getDirectory("Choose Destination Directory ");
+list = getFileList(dir1);
+//-- open a file for output and write a header
+f = File.open(dir2+File.separator+"output.txt");
+print(f, "Filename\tPixels");
+//-- make sure this is correct otherwise you'll be measuring the wrong thing!
+setOption("BlackBackground", false);
+for (i=0; i<list.length; i++) {
+showProgress(i+1, list.length);
+print(f, title+"\t"+d2s(List.getValue("RawIntDen")/255,0));
+//-- close the current file