// Macro by Michael Cammer michael@coxcammer.com June 2014 // Useful for having pictures printed on 4X6, 5X7, or other commercial lab size paper. //==================================================================== // A function turns any image into a 4X6 photo ready for printing. The photo will have a thin white border defined // as a percentage of the dimension (width or height) that most bumps up against the border. // Perhaps a later version would be programmed with a custom color border. var border = 0.01; // percentage for border var narrower = 4; var wider = 6; var ratio = narrower/wider; // in this case, 4X6 //============================================== macro "make single image 4X6 [q]" { path = getDirectory("image"); w = getWidth; h = getHeight; rotate = false; if (w < h) { run("Rotate 90 Degrees Left"); rotate = true; } // end if makeNewRatio(); if (rotate) run("Rotate 90 Degrees Right"); title = "4X6_" + getTitle(); rename(title); // save the new image run("Input/Output...", "jpeg=100 gif=-1 file=.txt use_file copy_column copy_row save_column save_row"); saveAs("Jpeg", path + title); } //============================================== function makeNewRatio() { w = getWidth; h = getHeight; if ( (w/h) >= (1/ratio) ) { newWidth = w + (border * w); newHeight = newWidth * ratio; } else { newHeight = h + (border * h); newWidth = newHeight / ratio; } run("Colors...", "foreground=black background=white selection=yellow"); run("Canvas Size...", "width="+newWidth+" height="+newHeight+" position=Center"); }