// Colorize.txt // G. Landini at bham. ac. uk // Macro to facilitate colorizing grayscale images setBatchMode(true); run("RGB Color"); id = getImageID; hue=64; sat=127; while(true) { waitForUser("Colourize", "Make a selection to paint"); Dialog.create("Colourize"); Dialog.addNumber("Hue (0-255):", hue) ; Dialog.addNumber("Saturation (0-255):", sat) ; setForegroundColor(255, 255, 255); // so when exiting it is white Dialog.show() ; hue=Dialog.getNumber(); sat=Dialog.getNumber(); t = selectionType; if (t==1||(t==2||t==3||t==4||t==9)) { run("Duplicate...", "title=temp"); run("Restore Selection"); run("HSB Stack"); setSlice(1); setForegroundColor(hue, hue, hue); run("Fill", "slice"); setSlice(2); setForegroundColor(sat, sat, sat); run("Fill", "slice"); run("RGB Color"); run("Select All"); run("Copy"); selectImage(id); run("Paste"); } }