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

Batch automating sequences of images.

New Here ,
Sep 17, 2019 Sep 17, 2019

Copy link to clipboard

Copied

Hi all,

 

I'm aware of the basic photoshop function allowing to batch automate images in a file, one by one, sequentially. Part of my work requires me to process four images at a time(say for example, 0117a, 0117b, 0117c, 0117d) down to one single (0117-final) image.

 

Is there a way for me to get batch automate to load four files at a time and then process an action on them? Or would I first have to get Bridge to organise them into files for each image number? Would it equally be possible to do this with a third-party action?

 

Thanks in advance for your help.

 

G

TOPICS
Actions and scripting

Views

2.1K

Translate

Translate

Report

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
Adobe
Community Expert ,
Sep 17, 2019 Sep 17, 2019

Copy link to clipboard

Copied

Have you tried using the Load Files into Stack script from the File menu? You could add to an action with a pause allowing you to choose the images then continue with the rest of the action. There is no way to completely automate this without scripting but this is close.

Votes

Translate

Translate

Report

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
New Here ,
Sep 18, 2019 Sep 18, 2019

Copy link to clipboard

Copied

That's the thing - I'm looking to completely automate it. For this project, it's around 5000 images being processed in groups of four down to about 1250 images, so ideally it'd be a script which can group those images into four, load them into photoshop and then run the action I have for them.

Votes

Translate

Translate

Report

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 ,
Sep 17, 2019 Sep 17, 2019

Copy link to clipboard

Copied

Four separate images open at a time... Or do you simply require a single open image with four layers? The action and batch command will do everything else?

 

Is the source a single folder?

 

Do all of the files sort correctly alphabetically?

 

Is the total file count evenly divisible by four?

 

Do the layers need to be in a specific order from bottom to top?

 

Are the images all the same width/height/orientation?

 

Does the layered file need the suffix alphabetical character/letter removed so that the filename only consists of digits/numbers? Are there variations on file name patterns or is the naming consistent?

Votes

Translate

Translate

Report

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
New Here ,
Sep 18, 2019 Sep 18, 2019

Copy link to clipboard

Copied

It doesn't really matter for me if they open in PS as four separate images, or one image with four layers. The photoshop action groups them into on image of four layers if needed, does everything else, saves, and closes.

 

The source is a single folder, and the files are sorted numerically, 1 through to about 1250, with each number having an a, b, c and d file, if that makes sense. So 00001a, 00001b... 00001d through to 01250a, 01250b, 01250c and 01250d. The total file count is thus divisible by four.

 

The layers need to be in a specific order, yes, so that the "a" image is loaded in first. I could easily re-write the action i use though, if the layers came in differently, so long as they came through in the same order for each set of four.

 

All the images are the same height, width and orientation.

 

The naming is consistent, and the final product has the file number with a suffix on it.

 

Thanks for your help!

Votes

Translate

Translate

Report

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 ,
Sep 18, 2019 Sep 18, 2019

Copy link to clipboard

Copied

OK, I’ll presume the following then:

 

* Single source folder

 

* Alphabetical sort

 

* No specific layer order if combined into a single-layered image

 

However, you also mentioned changing the file-name:

 

So, does the layered file need the suffix alphabetical character/letter removed so that the filename only consists of digits/numbers? Are there variations on file name patterns or is the naming consistent?

 

 

Votes

Translate

Translate

Report

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
New Here ,
Sep 18, 2019 Sep 18, 2019

Copy link to clipboard

Copied

Apologies - I hit enter accidentally before finishing my reply.

Votes

Translate

Translate

Report

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 ,
Sep 18, 2019 Sep 18, 2019

Copy link to clipboard

Copied

No problems, the new forum software leaves a lot to be desired, I have to enter a single sentence, then edit my reply to include multiple lines/paragraphs!

 

You mentioned input files such as: 0117a, 0117b, 0117c, 0117d

With the desired final filename to be: 0117-final

 

So removing the a, b, c, d and changing to -final ???

Votes

Translate

Translate

Report

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
New Here ,
Sep 18, 2019 Sep 18, 2019

Copy link to clipboard

Copied

That's what I had to do too haha. Replying to the above:

 

They're sorted alphanumerically, yes, so the a, b, c and d files pre-exist in the correct order.

 

No specific layer order, but it would need to be consistent when files are pulled into photoshop. I assume it would be.

 

The layered and processed file does not need the alphabetical character removed. It's saved through the action I have in photoshop as 'xxxxxd copy' where xxxxx is whatever file number the files relate to, and the d character from the last image in that group of four. Naming is totally consistent.

 

In your example below, the final filename would be 0117d final.

Votes

Translate

Translate

Report

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 ,
Sep 19, 2019 Sep 19, 2019

Copy link to clipboard

Copied

I'm still looking into this... I am creating a new reply as the threaded reply's to a reply may be missed.

 

I'm only a newb to scripting, so my attempts to modify an existing file input loop that is based on 2 files have not worked for 4 files.

 

If anybody can offer a snipped of generic sample code to open a source folder of files into groups of 2, 3, 4 or more layers that would be very helpful to the community.

 

I have had to go to "Plan B", which is to adapt another totally different script for this purpose... I have been able to successfully combine the input folder into alphabetically sorted groups of 4 layers and save out a .PSD file.

Votes

Translate

Translate

Report

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 ,
Sep 20, 2019 Sep 20, 2019

Copy link to clipboard

Copied

guillems62282138 – I now have a workable solution, however, it is not my preferred solution.

 

I have adapted on of JJMack's photo collage scripts "BatchMultiImageCollage.jsx":

 

http://www.mouseprints.net/old/dpr/PhotoCollageToolkit.html

http://www.mouseprints.net/old/dpr/PhotoCollageToolkit.zip

 

Please download the original script package, as there is a supporting script required (plus you may find other scripts useful too).

 

You'll need to create a "template" file that has a flattened Background layer. This template file will also need to have 4 blank/white alpha channels named Image 1 and Image 2 and Image 3 and Image 4 and will need to be the same pixel dimensions/resolution/orientation as the image sets being processed.

 

The script has a GUI, where you will select the template file, the input folder and an output folder to save the files to.

 

The modified script will use the upper/top/front layer name for the final file, removing the alpha character suffix and adding " Final" to the name.

 

i.e.:

 

5678A.jpg
5678B.jpg
5678C.jpg
5678D.jpg
9876a.jpg
9876b.jpg
9876c.jpg
9876d.jpg

 

5678 Final.psd

9876 Final.psd

 

You can enter the name of the action set and action into the script so that the 4 stack layered file is processed before saving, or additional scripting code could be entered as well.

 

If there is interest, I'll post a link to the modified script as it is too large to comfortably post.

 

Votes

Translate

Translate

Report

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
New Here ,
Sep 23, 2019 Sep 23, 2019

Copy link to clipboard

Copied

Thank you so much - this sounds perfect. I'll test it this week and let you know how it goes! I've had a read of the script already and it looks ideal .

 

I think I've figured out where I could add the action I'd need to play, around line 553 or so. This was really the crux of what I needed though. 

Votes

Translate

Translate

Report

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 ,
Sep 23, 2019 Sep 23, 2019

Copy link to clipboard

Copied

You can find the modified code here:

 

https://gist.github.com/MarshySwamp/b07e0cf6b1a0765c5ba84909c266a89c

 

https://gist.githubusercontent.com/MarshySwamp/b07e0cf6b1a0765c5ba84909c266a89c/raw/039346f0a57c079b...

 

The support script is here, as well as in JJMack's previously linked .zip archive:

 

https://gist.github.com/MarshySwamp/47aed30f86a36645d2d91e3f75452507

 

https://gist.githubusercontent.com/MarshySwamp/47aed30f86a36645d2d91e3f75452507/raw/6612d6f8ad7d8a0f...

 

I added two extra blocks of code to JJMack's original script:

 

The original script was not processing in alphabetical order, it was mixing up the image sets, so I added a forced sort:

 

 

 

//////////////////////////////////////////////////////////////

             // Enforce Alpha-numeric Sort - ADDED BY STEPHEN A. MARSH 2019
             fileList.sort();
             
////////////////////////////////////////////////////////////// 

 

 

 

And here is the "major" addition, you will need to uncomment/remove the // double forward slashes from the line

 

//app.doAction("MyAction", "MyActionSet.atn");

 

Then replace the MyAction and MyActionSet.atn with your specific action.

 

 

 

//////////////////////////////////////////////////////////////   

                           // Layer Name from Top Layer with Digits Removed - ADDED BY STEPHEN A. MARSH 2019
                           var doc = app.activeDocument;
                           doc.activeLayer = doc.layers[doc.layers.length = 0]; // Select the top layer
                           var layerName = doc.activeLayer.name.replace(/[a-z]+$/ig, ''); // Regex to remove single or multiple consecutive case insensitive alphabetical characters from the end of the layer name when used in the filename
                           // doc.activeDocument.backgroundLayer.remove(); // Remove the Background layer
                           doc.activeLayer = doc.layers[doc.layers.length-1]; // Select the back layer
                           doc.activeLayer.remove(); // Remove the active layer
                           doc.channels.removeAll(); // delete alphas  
                           
////////////////////////////////////////////////////////////// 

                           // Play Action - ADDED BY STEPHEN A. MARSH 2019
                           //app.doAction("MyAction", "MyActionSet.atn"); // Change the action and action set as required
                           
                           // Or add additional code to do something else to the layered sequence stack before saving...
                           
//////////////////////////////////////////////////////////////  

                           //Save output file - MODIFIED BY STEPHEN A. MARSH 2019
						outputFile = outputFolder + "/" + layerName + " Final";
                        
//////////////////////////////////////////////////////////////  

 

 

Votes

Translate

Translate

Report

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
New Here ,
Sep 23, 2019 Sep 23, 2019

Copy link to clipboard

Copied

I'm eternally grateful. Thank you so much.

Votes

Translate

Translate

Report

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 ,
Sep 23, 2019 Sep 23, 2019

Copy link to clipboard

Copied

Glad to help, let me know how it goes and if it needs any modifications.

Votes

Translate

Translate

Report

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 ,
Nov 21, 2019 Nov 21, 2019

Copy link to clipboard

Copied

LATEST

Votes

Translate

Translate

Report

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