// Like the Process/Math/Gamma command, this script // allows you to interactively adjust the gamma of an image img = IJ.openImage("http://imagej.nih.gov/ij/images/boats.gif"); img.show(); ip = img.getProcessor(); ip.snapshot(); dialog = GenericDialog("Gamma Adjuster"); dialog.addSlider("Gamma:", 0.05, 5.0, 1); listener = new DialogListener ({ dialogItemChanged : function(gd, event) { gamma = gd.getNextNumber(); ip.reset(); ip.snapshot(); ip.gamma(gamma); img.updateAndDraw(); return true; } }); dialog.addDialogListener(listener); dialog.showDialog(); if (dialog.wasCanceled()) { ip.reset(); img.updateAndDraw(); }