If you’ve ever needed to add a text layer that contains the name of the open file here is a script to make it happen.
Download the script: AddFileName20pt.jsx and double click to unzip the file.
Quit Photoshop.
Place the script in your Photoshop CS5/Presets/Scripts folder.
Launch Photoshop.
Open your image.
Select File > Scripts > AddFileName20pt
A word of caution, it is doubtful that the script will add the type layer at the exact size and in the exact position that you will want it. In order to make changes to the type style (size, font, color etc.), it is CRITICAL (especially if you are recording the script as part of an action) that you double click on the “Filename” type layer in the Layers palette and make changes to the type (font, size etc.) using the Options bar. Do NOT swipe the text in the image area or it will record that file’s name as part of the action and all of the following images will be named the same as the first one that you recorded!
Special thanks to Thomas Ruark at Adobe for creating this script.

Where can I find the script to download?
Sorry, I just updated the post and added a link to download the script.
This script does not seem to work with Photoshop CS5… either that or it’s impossible to set the activeDocument to the currently open one
I just tested it again and it works for me if I follow the steps above. Are you on Mac or Windows? (Note the type layer will be named “Filename” but the actual name of the file will appear in the image area.)
Can you give any indication how to automate the position of the inserted file name text layer?
When you are recording the action, you can use the Move tool or Free Transform to reposition the type. You can also use any of the options in the Options bar to make changes to the type such as change the font or size – but if you make changes to the Type tool’s options, you need to remember to only select the Type layer and make changes, don’t select the individual characters of the type.
Many thanks. I’m still coming to grips with “actions”
I’m experiencing a problem trying to incorporate this into an action. I double click the text layer to change the font size and colour in the options bar, but I’m getting the filename of the image used to create the action every time I do this. I can move the layer ok without it changing, but one I attempt to edit the font it changes. Am I missing something, or is it possible to edit the script to use the font, colour and position I want?
Dont double click the text layer. Just click the text layer to select it, select the type tool and change the font etc in the options bar.
I want to batch a bunch of files using the script so I recorded an action to change the font, size, postion, etc. however when I run the batch, it puts the same file name that I used to create the action on all of my files. How can I get it to add the correct filename?
You can make any changes to the text if you select the type tool and make the changes in the Options bar. If you select the type in the image area using the text tool, then you will only get the first name that you changed when recording the script.
YESSSSSSSSSS! It worked this time. I was highlighting the text and changing it in the options bar instead of leaving the text unhighlighted. This is going to save me alot of time and headaches. Thank you a bunch!!!
thank you so much for these instructions & script! It took me a bit of time to figure out NOT to double-click the type layer, but I finally got my action to work. I love love love batches and watching my computer work for me while I sit back and relax
Any suggestion for special characters like dashes?
Is there any script that would add text layers with PS layers titles?
Not that I know of. I have one here that will add a text layer with the file name, but that’s not exactly what you want.
http://blogs.adobe.com/jkost/2010/09/open-make-and-rename-layer.html
Julianne, once more your in-depth knowledge of this tool has saved me hours of manual work not to mention made it impossible for me to enter a typo. And thanks to Thomas for writing such a handy script!!
I was very exited to find this because it was going to save me much time, the issue is every time it adds the text it is random sizes in each image..so all my images end up with different results after running a batch.
Are you sure that it’s the text size that is changing? I have a feeling that the images that you are running the script on are different sizes.