FORUMS: list search recent posts

Watermarking/branding images with filename script saving issue

COW Forums : Adobe Photoshop

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Patrick Wagner
Watermarking/branding images with filename script saving issue
on May 19, 2011 at 4:13:45 pm

Hi,

I use a script that was from an old post and I'm having some troubles.

I want to print and/or save my files with the watermark of the filename (which works correctly in the script below)

My script loads all images in a folder I specify and then it adds the layer with the filename and that's it.

I really need it to save as a jpg or png once the layer with filename has been added.

Can someone please help me with this last saving function issue??

Thank you in advance,

the script is below
------start--------
/*
Description:
This script is a template script that will
open and process a folder of images
*/

// enable double clicking from the
// Macintosh Finder or the Windows Explorer
#target photoshop

// Make Photoshop the frontmost application
// in case we double clicked the file
app.bringToFront();


///////////////////////////
// SET-UP //
///////////////////////////


// A list of file extensions to skip, keep them lower case

gFilesToSkip = Array( "db", "xmp", "thm", "txt", "doc", "md0", "tb0", "adobebridgedb", "adobebridgedbt", "bc", "bct" );


// Pops open a dialog for the user to
// choose the folder of documents to process

var inputFolder = Folder.selectDialog("Select a folder of documents to process");


// Pops open a dialog for the user to
// set the output folder

var outputFolder = Folder.selectDialog("Select a folder for the output files");



///////////////////////
// MAIN //
//////////////////////



// Open Folder of Images

OpenFolder();


// show the path to an output folder

alert(outputFolder);



///////////////////////////
// FUNCTIONS //
///////////////////////////



// Given the a Folder of files, open them

function OpenFolder() {
var filesOpened = 0;
var fileList = inputFolder.getFiles();
for ( var i = 0; i < fileList.length; i++ ) {
// Make sure all the files in the folder are compatible with PS
if ( fileList[i] instanceof File && ! fileList[i].hidden && ! IsFileOneOfThese( fileList[i], gFilesToSkip )) {
open( fileList[i] );
filesOpened++;


/////////////////////////////////////
// Put all your processing functions... //
/////////////////////////////////////

// Alert and show the document name
alert(app.activeDocument.name);

var originalUnits = app.preferences.rulerUnits
app.preferences.rulerUnits = Units.PIXELS

app.foregroundColor.rgb.red = 255
app.foregroundColor.rgb.green = 255
app.foregroundColor.rgb.blue = 255

// add the pixel position for the left side of your text block below
var textLeftPosition= 260

// add the pixel position for the bottom of your text block below
var textBottomPosition= 260

var typeLayer = app.activeDocument.artLayers.add();

typeLayer.name = app.activeDocument.name;
typeLayer.kind = LayerKind.TEXT;
typeLayer.textItem.size = 48;
typeLayer.textItem.position = [textLeftPosition, textBottomPosition];
var layerName = typeLayer.name
typeLayer.textItem.contents = layerName;




// Cloes the file without saving


//Save as a JPEG to the outputFolder

// Close without saving

}

////////////////////////////////////////////
// ...in the area between these two comments. //
////////////////////////////////////////////


}

}


// given a file name and a list of extensions
// determine if this file is in the list of extensions

function IsFileOneOfThese( inFileName, inArrayOfFileExtensions ) {
var lastDot = inFileName.toString().lastIndexOf( "." );
if ( lastDot == -1 ) {
return false;
}
var strLength = inFileName.toString().length;
var extension = inFileName.toString().substr( lastDot + 1, strLength - lastDot );
extension = extension.toLowerCase();
for (var i = 0; i < inArrayOfFileExtensions.length; i++ ) {
if ( extension == inArrayOfFileExtensions[i] ) {
return true;
}
}
return false;
}
-------END---------


Thank you for your help.
I need help ASAP since I need to complete this project shortly

Patrick


Return to posts index

Richard Harrington
Re: Watermarking/branding images with filename script saving issue
on May 26, 2011 at 4:43:52 pm

Look at the Image Processor script built in to Phostshop

Richard M. Harrington, PMP

Author: From Still to Motion, Video Made on a Mac, Photoshop for Video, Understanding Adobe Photoshop, Final Cut Studio On the Spot and Motion Graphics with Adobe Creative Suite 5 Studio Techniques


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]