This script uses photoshop cs3 or Photoshop Elements to create a border for your jpg images. It will also enter the copyright information for your image. A directory will be created in the same directory where the original images are. The new images will be saved with the same name as the original image. The directory name is an argument on the command line. To start the script type:
cscript CreBorders.vbs c:\images
This is the result of the script :
'***************************************************************** '** Script: CreBorders.vbs '** Version: 1.0 '** Created: 12/29/2008 9:51PM '** Author: Adriaan Westra '** E-mail: '** Purpose / Comments: '** Create borders and set copyright info for images '** '** '** Changelog : '** 29-12-2008 9:37 : Initial version '** '***************************************************************** Dim Version : Version = "1.0" ' Script version Dim Author : Author = "A. Westra" Dim Copyright : Copyright = "�" Dim Website : Website = "http://www.westphil.nl" Dim Email : Email = "" Dim appPhotoshop Dim objImage Dim strFileName '***************************************************************** '** Add Error Handling on error resume Next '***************************************************************** '** Make sure the script is started with cscript If InStr(wscript.FullName, "wscript.exe") > 0 Then MsgBox "Please run this script with cscript.exe." & Chr(13) & _ "For example : cscript " & WScript.ScriptName & " /?", _ vbExclamation, WScript.ScriptName WScript.Quit(1) End If '***************************************************************** '** Get commandline parameters Set Args = Wscript.Arguments If Args.Count = 0 Then strImageDir = InputBox("Please give the directory name " & _ "to process : ",wscript.scriptname, strPath) Else If InStr(Args(0),"/?") > 0 Or InStr(UCase(Args(0)),"/H") > 0 _ Or InStr(UCase(Args(0)),"/HELP") > 0 Then DisplayHelp Wscript.quit(0) Else strImageDir = Args(0) End if End if '***************************************************************** '** Get startup path from scriptfullname Pos = InStr(wscript.ScriptFullName, wscript.ScriptName) strPath = Mid(wscript.ScriptFullName,1,Pos - 1) '***************************************************************** '** Create output directory strOutputDir = strImageDir & "\full" Set objFSO = CreateObject("Scripting.FileSystemObject") If Not (objFSO.FolderExists(strOutputDir)) Then Set objOutDir = objFSO.CreateFolder(strOutputDir) End If '***************************************************************** '** Open Photoshop Set appPhotoshop = CreateObject( "Photoshop.Application" ) appPhotoshop.BringToFront '***************************************************************** '** Remember current unit settings and then set units to '** the value expected by this script Dim originalRulerUnits originalRulerUnits = appPhotoshop.Preferences.RulerUnits appPhotoshop.Preferences.RulerUnits = 2 strtTypeUnits = appPhotoshop.Preferences.TypeUnits appPhotoshop.Preferences.TypeUnits = 5 ' psTypePoints appPhotoshop.DisplayDialogs = 3 ' psDisplayNoDialogs '***************************************************************** '** Process directory Set objImgDir = objFSO.GetFolder(strImageDir) For each objFile in objImgDir.Files '***************************************************************** '** If file is jpg image then Create thumbnail If IsJPG(objFile.Name) Then strFileName = strImageDir & "\" & objFile.name '***************************************************************** '** Open the file in Photoshop Set objImage = appPhotoshop.Open( strFileName ) '***************************************************************** '** Calculate a new width and height for the image nWidth = objImage.width * objImage.resolution nHeight = objImage.height * objImage.resolution nWidth = (nWidth + 20) / objImage.resolution nHeight = (nheight + 20) / objImage.resolution '***************************************************************** '** Set backgroundcolor to black appPhotoshop.BackgroundColor.RGB.Red = 0 appPhotoshop.BackgroundColor.RGB.Green = 0 appPhotoshop.BackgroundColor.RGB.Blue = 0 '***************************************************************** '** Extend the canvan 10 pixels on all sides ( black border ) objImage.ResizeCanvas nWidth, nHeight, 5 '***************************************************************** '** Calculate a new width and height for the image nWidth = objImage.width * objImage.resolution nHeight = objImage.height * objImage.resolution nWidth = (nWidth + 4) / objImage.resolution nHeight = (nheight + 4) / objImage.resolution '***************************************************************** '** Set backgroundcolor to White appPhotoshop.BackgroundColor.RGB.Red = 255 appPhotoshop.BackgroundColor.RGB.Green = 255 appPhotoshop.BackgroundColor.RGB.Blue = 255 '***************************************************************** '** Extend the canvan 2 pixels on all sides ( white border ) objImage.ResizeCanvas nWidth, nHeight, 5 '***************************************************************** '** Calculate a new width and height for the image nWidth = objImage.width * objImage.resolution nHeight = objImage.height * objImage.resolution nWidth = (nWidth + 50) / objImage.resolution nHeight = (nheight + 50) / objImage.resolution '***************************************************************** '** Set backgroundcolor to black appPhotoshop.BackgroundColor.RGB.Red = 0 appPhotoshop.BackgroundColor.RGB.Green = 0 appPhotoshop.BackgroundColor.RGB.Blue = 0 '***************************************************************** '** Extend the canvan 25 pixels on all sides ( black border ) objImage.ResizeCanvas nWidth, nHeight, 5 nWidth = objImage.width * objImage.resolution nHeight = objImage.height * objImage.resolution nWidth = (nWidth + 2) / objImage.resolution nHeight = (nheight + 2) / objImage.resolution appPhotoshop.BackgroundColor.RGB.Red = 255 appPhotoshop.BackgroundColor.RGB.Green = 255 appPhotoshop.BackgroundColor.RGB.Blue = 255 objImage.ResizeCanvas nWidth, nHeight, 5 Set textColor = CreateObject( "Photoshop.SolidColor" ) textColor.RGB.Red = 255 textColor.RGB.Green = 255 textColor.RGB.Blue = 255 '***************************************************************** '** Create a new art layer, set it to a text layer. Set artLayerRef = objImage.ArtLayers.Add layerKind = 2 ' psTextLayer artLayerRef.Kind = layerKind '***************************************************************** '** Set the contents and other properties of the text layer. Set textItemRef = artLayerRef.TextItem textItemRef.Size = 35 textItemRef.Font = "BickhamScriptPro-Regular" textItemRef.Color = textColor textItemRef.Contents = Copyright & " " & Author Posx = ((objImage.width * objImage.resolution) - 135) / objImage.resolution Posy = ((objImage.height * objImage.resolution) - 5) / objImage.resolution textItemRef.Position = Array( Posx, Posy ) '***************************************************************** '** Flatten image objImage.flatten '***************************************************************** '** Set copyright info Set ImgInfo = objImage.Info ImgInfo.Copyrighted = 1 'for psCopyrightedWork ImgInfo.OwnerUrl = Website ImgInfo.Author = Author ImgInfo.CopyrightNotice = Copyright & " " & Author If objImage.width > objImage.height Then WidthInPixels = 800 HeigthInPixels = 532 Else WidthInPixels = 354 HeigthInPixels = 532 End If resolution = 72 nWidth = WidthInPixels / resolution nHeight = HeigthInPixels / resolution '***************************************************************** '** Resize the image objImage.ResizeImage nWidth,nHeight, resolution, 4 '***************************************************************** '** Set jpg options Set jpgSaveOptions = CreateObject( "Photoshop.JPEGSaveOptions" ) jpgSaveOptions.EmbedColorProfile = True jpgSaveOptions.FormatOptions = 1 ' psStandardBaseline jpgSaveOptions.Matte = 1 ' psNoMatte jpgSaveOptions.Quality = 12 outFileName = strOutputDir & "\" & objFile.name '***************************************************************** '** Save the new image with borders and copyright info objImage.SaveAs outFileName, jpgSaveOptions, True, extType '***************************************************************** '** Close image objImage.close(2) End If Next appPhotoshop.Preferences.RulerUnits = originalRulerUnits appPhotoshop.Preferences.TypeUnits = strtTypeUnits '***************************************************************** '** Close Photoshop appPhotoshop.Quit '***************************************************************** '** End script Wscript.Quit() '***************************************************************** '** Sub: DisplayHelp '** Version: 1.0 '** Created: 24-03-2003 8:22 '** Author: Adriaan Westra '** E-mail: '** '** Purpose / Comments: '** Display help for script '** '** Arguments : '** '** Wijzigingslog : '** 24-03-2003 8:22 : Initi�le versie '** '***************************************************************** Sub DisplayHelp() strComment = string(2,"*") strCmntLine = String(79, "*") wscript.echo strCmntline wscript.echo strComment wscript.echo strComment & " Online help for " & _ Wscript.scriptname & " version : " & Version wscript.echo strComment wscript.echo strComment & " Usage : cscript " & _ Wscript.scriptname & " directoryname" wscript.echo strComment wscript.echo strComment & " Purpose : Create borders " & _ "and set copyright info for all images in given directory" wscript.echo strComment wscript.echo strComment & " Author : " & Author wscript.echo strComment & " E-mail : " & Email wscript.echo strComment wscript.echo strCmntline End Sub '***************************************************************** '** Function: IsJPG '** Version: 1.0 '** Created: 12/29/2008 11:01PM '** Author: Adriaan Westra '** E-mail: '** '** Purpose / Comments: '** Determine if file is jpg image '** '** Arguments : '** strFilename : name of the file to check '** '** Wijzigingslog : '** 12/29/2008 11:02PM : Initi�le versie '** '***************************************************************** Function IsJPG(strFilename) Set objRegExp = New RegExp objRegExp.Pattern = "\w.jpg" objRegExp.IgnoreCase = True IsJPG = objRegExp.Test(strFileName) End Function