@pdxrjt asked about adding borders to layers because the Image>Add Borders option adds a border to the entire image while he/she wants to add borders to various smaller images added as layers in a collage. I believe the attached script will do the task. It uses Gary Barton's Find Selection Point script to locate the selection border to be filled.
THIS SCRIPT WILL ADD A BORDER TO SMALLER LAYER IMAGES REGARDLESS OF THEIR SHAPE OR ORIENTATION - I.E. THEY CAN BE HORIZONTAL/VERTICAL, ROTATED TO SOME DEGREE, OR NON-RECTANGULAR SHAPES. Also, if you have multiple layers with smaller images, if you first merge just all of those layers prior to running the script it will put the border on all of the images at once, so long as you are satisfied with having the same size and color of border for all such images.
You first have to have the layer you want to work on active in the Layers Palette then run the script. Basically, it uses the magic wand with Opacity selected to select the upper left pixel of the image which generally (when working with layers of a collage, with picture tube layers, etc.) will be transparent. Then it inverts the selection, creating a selection around the opaque part of the image, modifies that selection by Select Selection Borders, lets you set the border size, then fills the border with whatever your present foreground color is and finally de-selects the selection. You can then activate the next collage layer and run it again, etc.
This script will work on a collage image even if you have rotated the images in your collage to varying degrees, which is often the way people create collages. This script will also work on layers with irregularly shaped images - i.e., non-rectangular/square like, circles, ovals and those of some picture tubes, etc (although don't do it on tubes that have their own drop shadows as it will put the border around the shadow also). This gets around the limitation of using the Layer Opaque tool option which creates a vertical/horizontal rectangular border that is constrained by the size of the corners of the image and not around only the opaque rotated part of the image.
HINT: When running the script on non-rectangular images like picture tubes, or even an a rectangular image that is rotated in less than 90 degree increments, consider checking the Anti-alias box in the dialogue that sets the selection borders to achieve smoother results. Images rotated less than 90 degrees do have jaggy edges, and selections around irregular shapes are not smooth without anti-alias. With large images this is imperceptible but when zoomed in a lot you'll see that.
ONE NOTE: This script creates a selection border INSIDE the image, rather than outside. That is because when you create a selection border outside the image the outside corners of the border are not square. Creating an inside border creates square corners. With some editing this script could be modified to deal with the issue by making a copy of the image resized larger than the original by the number of pixels you want the border to be but I didn't feel like going that far.
This script can also easily be modified to allow you to select the foreground color while the script is running. I have added an attached script that modifies the original to add a drop shadow after filling the border, which is often a nice effect doing a collage or with images added to a DVD cover or other artwork. If you use that version you can always cancel the drop shadow when that dialogue appears.
I just also noticed that it sets your Selection tool to Remove - easily fixed but just a warning the next time you decide to use your selection tools and think they aren't working.
EDIT #2: I just replaced the two scripts (Dec. 28, 12:40pm MST)- NO change to how they work but just changed the name slightly to indicate they add borders to SMALLER layers (those added on top of a larger image), plus added explanations and instructions at the top of the scripts that can be read if opened with Edit mode.
PLEASE let me know if it doesn't work for you!
