When saving layers into separate files using the in-built Photoshop script we always get this annoying string of numbers at the start before the filename. But now I'm going to show you how to make a quick tweak to change that forever.
Whenever I write photography articles I often spend a lot of time taking screenshots to demonstrate the processes my readers need to take in order to accomplish whatever tutorial I'm writing. It's a great way to visualize what would otherwise be a whole load of writing. So I layer them up in Photoshop and then export them using the in-built Photoshop script. I do this because it saves me having to save each layer individually as separate files, Photoshop just does it for me.
But I always get this annoying string of numbers at the start of the filenames when they save. Until now I've just been putting up with it, but when I was confronted with a large stack of layers that I would have had to rename I decided to take off the gloves. To save you from this issue I decided to put the technique into this article. At the time of writing I'm doing this for Adobe Photoshop CC 2021 but I envisage this would work for future and past versions as well.
Make Some Changes
This process is quite simple and my steps below should hopefully mean almost anyone can follow along. However, only do this if you're confident with making the change, I won't be held responsible if you mess it up and have to reinstall Photoshop. But that said, I've put in a couple of foolproof safety nets, so if you do run into trouble (or accidentally delete something you shouldn't have) you'll be able to revert it back to normal without needing to reinstall the application. Below I'll outline the process for this tweak in both Windows 10 and macOS X, more specifically I'll be showing you this on Windows 10 Pro 2004 19041.685 and macOS X Catalina Version 10.15.7 but the process should be identical for almost any recent versions of those operating systems.
Windows 10
- Navigate to This PC>Your Primary HDD or SSD>Program Files>Adobe>Adobe Photoshop 2021>Presets>Scripts
- Locate the file Export Layers To Files.jsx
- Copy the file and paste it into another folder (either your desktop or elsewhere)
- Also, make another copy somewhere else on your computer - this will be a safe version that we can overwrite if anything goes wrong
- Open up one of the copies in Notepad
- Navigate to fileNameBody += "_" and put a // in front of it now it should read: //fileNameBody += "_"
- Look for fileNameBody += "_" + layerName; and delete the "_" + so it reads: fileNameBody += layerName;
- Go to File>Save to save the changes made and then copy and paste that file back into the Photoshop Scripts folder. Click overwrite if it prompts you
- You should now be able to Export Layers to Files without the problem of having all those awkward sequence numbers at the beginning.
macOS X
- Navigate to your Applications (When desktop is selected press Cmd + Shift + A)
- Scroll down to Adobe Photoshop CC 2021
- Open the folder named Presets then choose Scripts
- Then make the following steps as above but open the file in TextEdit instead of Notepad
That's the difficult bit out of the way. With the script edited, and one unchanged version saved on the computer in case anything goes wrong, we now have to prepare our layers in Photoshop CC ready for export. If you've done this before you probably won't need the rest of the steps below, but there are still a couple of things that could catch you out and leave you with awkwardly named files, so it might be worth skimming over even if you're au fait with exporting layers to files already.
Name Your Layers
Now that you've altered the script Photoshop CC 2021 should now be able to export your layers to files and not rename them with a string of numbers. So first of all make sure that all your layers are named how you want them to be saved. Double-click on the layer name in the layers palette and type in the filename you want, then click enter.
Start to Export
After naming all your layers correctly it's time to export them. Head to File>Export>Layers to files. There will be another window that pops up with some settings. I strongly recommend deleting the file name prefix here because otherwise, you'll end up with this added to the beginning of every file that's saved.
Choose Your Destination and Save
Next, click Browse. In the window that appears navigate to (or create) the folder, you want to save your images into. Click OK. Then make sure you've selected the right file format and, if appropriate, the quality you want to save them as. If you have layers in your Photoshop document that are hidden and you don't want them exported then tick the Visible Layers Only button. Finally, click run.
Once the export has finished Photoshop will flash a sub-window saying "Export Layers To Files was successful". Head to the folder and have a look — you should now have perfectly exported file names.
There's going to be some of you out there that are going to tell me that Bridge or Lightroom can rename the files for me, or that I could just not be lazy and go do it myself. But take a moment to think about those workarounds. It means I have to go out of Photoshop, into another software, and make changes to fix a problem (at least, a problem for me) that I could just eradicate in the first place. Also, what if you're an illustrator or an artist working in Photoshop? There are often tens, hundreds, or even thousands of layers in a single document - do you really mean to tell me that those users should go in and rename every single file by hand? No. With this simple tweak you can have things running smoothly every time without ever having to do any of the heavy lifting... err, typing.
Main image made in part by Rakicevic Nenad via Pexels
If you'd like to take your photo editing to a new level, make sure to check out the variety of Photoshop tutorials and plugins that will speed up your workflow and help you create stunning, professional work. Save 15% by using "ARTICLE" at checkout.
I am new to the concept of saving layers, so would someone tell me why you would save them, please? I'm intrigued because I frequently have to merge layers because my files exceed the size limit. Thanks!
THANK YOU!! Saved me so much time!