// Kyrre Baker 16.03.08 02.29 // PhotoCanvas v. 1.2.5 // Create a photo border / photo canvas in Photoshop CS2 and CS3 // http://kyrrebaker.com/2008/03/script_for_a_lage_en_fotoramme_i_photoshop/ // ==== CHANGELOG ==== // // v. 1.2.5 / 16.03.08 02.29 // Minor tweaks // v. 1.2.4 / 12.03.08 11.58 // Tweaked the text offset // v. 1.2.3 / 11.03.08 15.59 // Changed the default font from "Verdana" to "Gill Sans" ( ref: http://en.wikipedia.org/wiki/Gill_Sans ) // If there is no "title" submitted the title-layer is not created // ==== CHANGELOG END ==== // // Enable double clicking from the Macintosh Finder or the Windows Explorer #target photoshop // If double clicked, bring app to front app.bringToFront(); // ==== CUSTOMIZE ==== // // Signature signatureText = "EDIT THIS LINE"; // Signature settings signatureOffset = 41; signatureFontSize = 14; signatureFontName = "GillSans"; signatureFontAntiAliasing = "Crisp"; signatureFontColor = new SolidColor; signatureFontColor.rgb.red = 80; signatureFontColor.rgb.green = 80; signatureFontColor.rgb.blue = 80; // Title settings titleOffset = 61; titleFontSize = 24; titleFontName = "GillSans"; titleFontAntiAliasing = "Crisp"; titleFontColor = new SolidColor; titleFontColor.rgb.red = 128; titleFontColor.rgb.green = 128; titleFontColor.rgb.blue = 128; // Outer border settings outerBorderThickness = 30; outerBorderColor = new SolidColor(); outerBorderColor.rgb.red = 0; outerBorderColor.rgb.green = 0; outerBorderColor.rgb.blue = 0; // Inner border settings innerBorderThickness = 1; innerBorderOpacity = 100; innerBorderColor = new SolidColor(); innerBorderColor.rgb.red = 80; innerBorderColor.rgb.green = 80; innerBorderColor.rgb.blue = 80; // ==== CUSTOMIZE END ==== // if (documents.length > 0) { // Save old units and change temporary oldUnits = app.preferences.rulerUnits; oldDpi = app.activeDocument.resolution; app.preferences.rulerUnits = Units.PIXELS; app.activeDocument.resizeImage(null, null, 72, ResampleMethod.NONE); // Flatten all layers down to one before continue app.activeDocument.flatten(); app.activeDocument.activeLayer.isBackgroundLayer = false; app.activeDocument.activeLayer.name = "Picture"; // Get- and save the original document size oldWidth = app.activeDocument.width; oldHeight = app.activeDocument.height; // Resize canvas to make room for outer border newWidth = app.activeDocument.width + (outerBorderThickness * 2); newHeight = app.activeDocument.height + (outerBorderThickness * 2); app.activeDocument.resizeCanvas(newWidth, newHeight, AnchorPosition.MIDDLECENTER); // Resize canvas again to make room for the signature at the bottom newHeight = app.activeDocument.height + (outerBorderThickness * 3); app.activeDocument.resizeCanvas(newWidth, newHeight, AnchorPosition.TOPCENTER); // Create a layer for the outer border and make it active outerBorderLayer = app.activeDocument.artLayers.add(); outerBorderLayer.name = "Canvas"; outerBorderLayer.blendMode = BlendMode.NORMAL; app.activeDocument.activeLayer = app.activeDocument.layers["Canvas"]; // Select the original image area selectionBounds = new Array ( new Array(outerBorderThickness, outerBorderThickness), new Array(oldWidth + outerBorderThickness, outerBorderThickness), new Array(oldWidth + outerBorderThickness, oldHeight + outerBorderThickness), new Array(outerBorderThickness, oldHeight + outerBorderThickness) ); app.activeDocument.selection.select(selectionBounds, SelectionType.REPLACE); // Fill the outer border area app.activeDocument.selection.invert(); app.activeDocument.selection.fill(outerBorderColor); // Create the inner border layer and make it active innerBorderLayer = app.activeDocument.artLayers.add(); innerBorderLayer.name = "Border"; innerBorderLayer.blendMode = BlendMode.NORMAL; innerBorderLayer.opacity = innerBorderOpacity; app.activeDocument.activeLayer = app.activeDocument.layers["Border"]; // Fill the inner border app.activeDocument.selection.invert(); app.activeDocument.selection.expand(innerBorderThickness); app.activeDocument.selection.fill(innerBorderColor); app.activeDocument.selection.contract(innerBorderThickness); app.activeDocument.selection.clear(); // ==== SIGNATURE ==== // // New text-layer / Signature newTextLayer = app.activeDocument.artLayers.add(); newTextLayer.kind = LayerKind.TEXT; newTextLayer.name = "Signature"; newTextLayer.textItem.contents = signatureText; newTextLayer.textItem.position = Array(app.activeDocument.width / 2, app.activeDocument.height - signatureOffset); newTextLayer.textItem.font = signatureFontName; newTextLayer.textItem.size = signatureFontSize; newTextLayer.textItem.color = signatureFontColor; newTextLayer.textItem.anti-aliasing = signatureFontAntiAliasing; newTextLayer.textItem.justification = Justification.CENTER; // ==== SIGNATURE END ==== // // ==== TITLE ==== // // Ask for a title! titleText = Window.prompt("Please enter the title of Your picture."); // New text-layer / if Title is submitted if (titleText) { newTextLayer = app.activeDocument.artLayers.add(); newTextLayer.kind = LayerKind.TEXT; newTextLayer.name = "Title"; newTextLayer.textItem.contents = titleText; newTextLayer.textItem.position = Array(app.activeDocument.width / 2, app.activeDocument.height - titleOffset); newTextLayer.textItem.font = titleFontName; newTextLayer.textItem.size = titleFontSize; newTextLayer.textItem.color = titleFontColor; newTextLayer.textItem.anti-aliasing = titleFontAntiAliasing; newTextLayer.textItem.justification = Justification.CENTER; } // ==== TITLE END ==== // // Restore the original units app.activeDocument.selection.deselect(); app.preferences.rulerUnits = oldUnits; app.activeDocument.resizeImage(null, null, oldDpi, ResampleMethod.NONE); } else { alert("You must have at least one open document to run this script!"); } // EOF