Saving the layer name as the filename in save for web.. ?


I often have to resize many image files, and duplicating the layer into a psd file, then saving each individual layer as a web graphic.  When I select each layer to save from the save for web menu, it inputs the psd filename as default, which means I have to manually enter the name again for each layer.

Is there any way I can have photoshop (cs2) have the layer name for the save as (for web) box.

For example, i have many layers all in one file, called photoshop.psd  and each layer is named layer1 layer 2 layer 3 etc.

When I click save for web, it will have "photoshop"(.gif/.jpg) input automatically, so i have to edit that and change it to layer1.gif etc.. for each layer.  Is there any way to have photoshop have layer1.gif automatically if it is the selected layer, instead of the default photoshop.psd file name??

This is quite urgent..  any responses are appreciated!!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David BruggeCommented:
Take a look at File/Scripts/Export Layers To Files and see if this will do what you need
Before you save, flatten the images.  Then when you try to save, since you have flattened images its not a psd anymore, you should now be able to save in gif or jpeg.
There is no really easy way to accomplish this. I wrote an Action in that I renamed the Layer to Layer 1 and then saved for Web typed in the name "Layer 1" It seems to work but you may need to tweak it.
Also you can just click on the layer you want, save for web, rename your file. You can record an action that saves to web and uses the name you want. That way you would not need to retype the name each time. Hope this helps.

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

David BruggeCommented:
On the method that I described above (scripts/export layers to files) it does not use your layer name as the file name. Instead, the script asks you to enter a prefix name, and then it will number the files sequentially with the prefix as part of the name. I still think that it will do what you want.
thyrosAuthor Commented:
This isn't quite working for me.

Maybe if I rephrase it will help spark an idea.

Is there an easy way to select several layers in a file and 'save for web' ?  preferably, when it does that, it offers to save the optimized gif as the layer name.  Can that be done?

Right now, I am having to select each layer, then select save for web, then save, then repeat over for each layer.  Can't I select multiple layers and save them one after another without having to leave the save for web dialogue box?

It may not even be possible in this software!?!
David BruggeCommented:
Well, with a little knowledge of scripting (java or Visual Basic) you can write a script to do just that, but I'm not much of a coder so I can't help in that regard. If all else fails, you might go to one of the coding sections of EE and see if anyone has PhotoShop scripting experience.

It would be easy to take the existing “write Layers to Files” script and read the file name from the program, but I don’t have any idea what the call function for the layer name is.

I'm sure you would much rather find a simple solution. I hope there’s one out there to be found.
thyrosAuthor Commented:
Thank you all for your comments, I appreciate it.

I have found another method to simplfy my task.  It is not really a solution to this question, but it gets the job done for me.

Basically, some of my work involves taking images from the web, saving them, then resizing to 3 different sizes, and to top it all of, I need to have a final consistent image size..  i.e. after making thumbnails I then have to resize the canvas so that all images fit inside a fixed dimension.  So this meant saving an image, opening it in photoshop, duplicating it, resizing it, then duplicating the layer into a another psd file which had the correct canvas size/dimensions.  Then I was saving each layer, and having to name it appropriately.   All this is pretty much already, but imagine having to do it for 300+ items, each one resized and renamed several times!  you do the math.

Anyway, I found it easier to just save the files with a normal name that describes the image, then do a batch resize and rename using irfanview.  For the rename purposes, I append a prefix like  thumb_originalfilename.gif etc.  After doing that, I just open the whole bunch of images in photoshop, and setup a macro using a program like shortkeys, one for doing the canvas resizing, and one for the shortcut of 'save for web'.  So then it is just a matter of hitting 3 or 4 buttons and my images are all saved with the correct canvas size.  man, what a Godsend!  

Wooky JackCommented:
That's great you found something!  Were any of these comments helpful?  Otherwise you can post a zero point question in Community Support to let a site mod decide whether this should be stored in the database ;)
David BruggeCommented:

Everyday, I have to prepare images for an online catalogue. The originals are various size files, but being print files, they are usually in the size of 9M to 12M each.  I have to make a thumbnail, a regular view and an enlarged view. Each save size has to be a particular dimension because the images load of the page dynamically.

My work flow is to gather a copy of all of the images in a folder and, opening them one at at time, use the crop tool to downsize to the largest web size (the enlarged view) and saving the file using the stock number for the image name. This folder I call lg for large size. When I get through I will use Photoshop to append "_lg" to each name.

Next I make a copy of this folder and run a batch that resized the large images into medium size files, applies sharpening and saves.

I then make a copy of THIS folder and run a batch that resizes to thumbnails and again applies sharpening. The files in this folder are renamed with "_tm" at the end of the name.

I rename the first folder to add the "_lg" and then drag them all to one folder and upload. The upload will have a 000001.jpg which is the middle size image, a 000001_lg.jpg which is the large image and a 000001_tm which is the thumb.

A data base of descriptions, prices,  and attributes is uploaded which has the image names (although they could just as easily be created dynamically using the stock number.

The whole process takes me about an hour and a half to do 300 images, most of that spent opening and cropping the originals and confirming the stock numbers match the images. The key is using the crop tool and writing actions to resize and sharpen that I can then batch.

If I had your job to do, I would add one step of opening a file, cutting a layer and repasting it to a new file. Because I do all of this with keyboard commands, it would take me just a few seconds per layer.

Best of luck

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
thyrosAuthor Commented:

Just an update.  Thank you all for your comments, they are very much appreciated.

Since posting this topic, I have not had to process such a large number of images anymore (Thank God!), and the method I described in an earlier post worked for me.

However, going by the question, the comments from D_Brugge are most helpful, in that there is a solution, even if I didn't use it, it is still possible, and therefore deserving of the points.  

Thank for your time.  Take care.
David BruggeCommented:
thanks thyros! Hope to be of more help next time.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Creative Suite CS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.