Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

how to save contactsheet with the same name as per source filename

Community Beginner ,
May 28, 2022 May 28, 2022

i want to create contact sheet for multiple files and there is one file per sheet, need to know how can we save the contactsheet with the same name as per source file name.

1.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 29, 2022 May 29, 2022

@Sagar246400162du3 – Try this script:

 

/* 
Save open Contact Sheet X files using text caption name.jsx
Stephen Marsh, 30th May 2022, v1.0
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-to-save-contactsheet-with-the-same-name-as-per-source-filename/td-p/12971194
Note: * All open files will be saved, to avoid errors, only have files open that are generated by the Contact Sheet X script
      * Output options -
            Save Sheet: unchecked/inactive 
            Keep Sheet 
...
Translate
Adobe
Community Expert ,
May 28, 2022 May 28, 2022

When you post a question you always need to tell the program you are using
There are MANY programs in a full subscription, plus other non-subscription programs
Please post the exact name of the Adobe program you use so a Moderator may move this message to that forum

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 28, 2022 May 28, 2022

Thanks Mr. John T Smith for your guidance.

I am first time user so uaware of how to describe.

I am using Adobe Photoshope 2020 64 bit version on 64 bit win10,  and using CSX-2_2 from Mr. Xbyter.

I am using CSX-2_2 script for converting multiple files to JPG with caption and saving them on another location, Script working fine as far as the caption is concerned, but the JPG files are getting saved as default name like "Sheet_0001, Sheet_0002 and so on".

Need help to save JPG with the same name as source file or caption of Contact sheet.

Note : I want to save only one image per sheet and the sheet must have the same name as original image name.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 29, 2022 May 29, 2022

@Sagar246400162du3 

 

Although xbytor's Contact Sheet 2 script could be modified, that is often easier said than done for such a complex script.

 

The quickest option for me would be to use a "helper" script that would save all open documents using the text layer caption content (so don't flatten cell layers in the script so that the caption text layer is retained).

 

Can you post a sample screenshot of of how the caption appears under the single image, and also the layers panel wide enough to view all content in the caption text layer? I can then write a script to process based on the text pattern.

 

What file format do you wish to save into? You mentioned JPEG? What compression and other options would it use? Do you want the Save As or Export > Save for Web (Legacy) JPEG option?

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 29, 2022 May 29, 2022

Thanks Stephen A Marsh,

I would like to bring below points for your information.

- Xbytor's CSX-2_2 works on one image at a time and close the same after script process before opening next document. and the script flatten all the layer's before saving and then closing the image as I am using below output parameters while running script.

1.jpg

 

 

- I had attache below screenshot for your better understanding of how script runs in my PC

1. input files folder (I have taken only 4 files for exmple, and source folder may contain subfolders also)

input folder.jpg

 

2. Output folder view ( here source folder/subfolder structure doesn't matter, but need to retain source file name.)

output folder.jpg

 

3. screenshot taken while running script 

    - Script opens new docs as per next serial no (i.e 0001, 0002, 0003 ans so on)

    - then create caption layer and and fill source file name only (%f) as i have selected option of caption without file extention.

   - then again script creates layer1 to fill source image (script swiftly fills the source image into layer1 and then save and close the images into output folders, so i was unable to take the screenshot of the same.)

script running screenshot.jpg

 

 hope my above explaination will help you understand the issue (just re-iterating , want to save contactsheet with the same name as source file name) in a better way and my screenshots are clear enough to check.

 

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 29, 2022 May 29, 2022

Thanks, once the script has finished processing, there is a text layer named after the source file.

 

output.png

 

In this example, the input file was named Portrait.jpg and here is how the layers look:

 

portrait.png

 

Although CSX2.2 has created a new document titled sheet_0001 – a "helper" script can be written to use the text layer name to save the file using that layer name, so the end result would be a saved file named "Portrait.jpg" in this example.

 

All I need is answers to the following:

 

* Save location, a fixed location hard-coded into the script (i.e. Desktop) or a prompt asking you to set the save directory

 

* Save As A Copy or Export/Save for Web (Legacy) JPEG format

 

* Quality level and other format options (Baseline standard etc)

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 29, 2022 May 29, 2022

Once again Thanks Mr. Stephen A Marsh for your quick reply.

The required answers mentioned below.

*Save location - Prompt asking to set the save directory

* Need to save as a copy

* Quality level and other formats : need to save as JPG with quality =12,  Format = Standard and color profile = sRGB

 

also one more request - where can i get "helper" script?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 29, 2022 May 29, 2022

@Sagar246400162du3 wrote:

also one more request - where can i get "helper" script?


 

Below, I just wrote it! :]

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 29, 2022 May 29, 2022

@Sagar246400162du3 – Try this script:

 

/* 
Save open Contact Sheet X files using text caption name.jsx
Stephen Marsh, 30th May 2022, v1.0
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-to-save-contactsheet-with-the-same-name-as-per-source-filename/td-p/12971194
Note: * All open files will be saved, to avoid errors, only have files open that are generated by the Contact Sheet X script
      * Output options -
            Save Sheet: unchecked/inactive 
            Keep Sheet Open: checked/active
            Flatten All Layers: unchecked/inactive
            Flatten Cell Layers: unchecked/inactive
*/

if (app.documents.length > 0) {

    (function () {

        // Select the output folder
        var outputFolder = Folder.selectDialog('Please select the save folder:');
        if (outputFolder === null) return;

        // Count open files
        var openFileCount = app.documents.length;

        // Loop through all open docs until no docs are open
        while (app.documents.length > 0) {
            saveOpenDocs();
        }

        // End of script notification
        alert(openFileCount + ' files saved to:' + '\r' + outputFolder.fsName);

        function saveOpenDocs() {
            activeDocument.activeLayer = activeDocument.layers[0];
            if (app.activeDocument.activeLayer.kind === LayerKind.TEXT) {
                var docName = activeDocument.activeLayer.name.replace(/\.[^\.]+$/, '');
                var saveFileJPG = new File(new File(outputFolder + '/' + docName + '.jpg'));
                saveJPG(saveFileJPG);
                app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
            } else {
                alert("The top layer is not a text layer!")
            }

            // Setup JPG options
            function saveJPG(saveFileJPG) {
                var jpgOptions = new JPEGSaveOptions();
                jpgOptions.formatOptions = FormatOptions.STANDARDBASELINE;
                jpgOptions.embedColorProfile = true;
                jpgOptions.matte = MatteType.NONE;
                jpgOptions.quality = 12;
                app.activeDocument.saveAs(saveFileJPG, jpgOptions, true, Extension.LOWERCASE);
            }
        }
    })();
}

else {
    alert('A document must be open to use this script!');
}

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

 

Edit: These are the output settings in CSX that work with this "helper script":

output.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 29, 2022 May 29, 2022

Bravo Mr. Stephen A Marsh, Thanks a lot

It worked like a magic.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 30, 2022 May 30, 2022

You're welcome! Thank you for the courtesy of a reply, correct answer and feedback!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 30, 2022 May 30, 2022

Good Morning Mr Stephen A Marsh,

Yesterday i used "Helper" Script, it worked fine, but later I faced below problem while running script, Mentioned below the step by step process flow.

 

* script opens all the selected docs as contact sheet in PS (issue - It can not open more than 400 images at a time, also so many open images required more storage space in Scratch Disk and lowers the performance)

* then starts renaming all contact sheets one by one -> save them as per new name -> closes the document.

 

My request is = can we open one image -> rename contactsheet -> save save contactsheet as per source image name -> close sheet -> then open next image for the same above process.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 30, 2022 May 30, 2022

Yes, I didn't know that you were working with so many images at once, it would be better to save as PSD to disk, batch rename and batch resave as a JPEG and then you can just delete the PSD files.

 

Ideally, the CSX2.2 script would be modified to directly save the filename as you require, however, that is a bit advanced for me, this is a complex script. Perhaps a more experienced scripter may step in...

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 30, 2022 May 30, 2022

It will be much faster to simply rename the files at the OS level, rather than opening them up in Photoshop. With this in mind, my suggestion would be to use ExifTool

 

Presuming that the PSD files contain a single text layer and are in a folder named "rename" on the desktop:

 

exiftool '-FileName<${TextLayerName;s/(\.[^\.]+$)//}.%e' 'path to desktop/rename'

 

The above example is formatted for the Mac, on Windows one would use straight double quote marks " and the appropriate full system path to the "rename" directory on the logged-in user's desktop.

 

Then one could use a script such as Image Processor or Image Processor Pro to batch convert the PSD to JPEG.

 

Otherwise, a different script would need to be written to open the PSD files and save them as JPEG and rename them in the same script.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 31, 2022 May 31, 2022
LATEST

@Sagar246400162du3 

 

OK, I believe that I have a new workable solution!

 

All you need to do is add a single line of code to the script.

 

Search for the 3rd, final entry of:

 

  layer.name = lname;

 

This should be at line 27152...

 

After this, add the following additional single line of code and save the script:

 

  activeDocument.info.title = lname.replace(/\.[^\.]+$/, '');

 

Now you can just save the contact sheets directly as JPEG files, it doesn't matter that the filename is incorrect.

 

Finally using Adobe Bridge, select all of the contact sheet files and use Tools > Batch Rename...

 

Rename the files using the Title metadata as per this screenshot:

 

Batch-Rename.png

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines