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

Combine multiple image sequences via action (and script?)

New Here ,
Apr 21, 2009 Apr 21, 2009

Copy link to clipboard

Copied

My problem in a way is pretty simple.

After assembling the render output of my 3d app in photoshop (32bit) and changing the appearance via several CC layers in different layer modes (e.g. Hue/saturation in Overlay mode) I ended up with my composing for print purposes. The comp is complex, with several masked folders, single masked CC layers and many image layers (some with masks).

Now the client wanted me to animate part of the image. No problem I thought. But the trap is of how to assemble the different image sequences (diffuse, specular, reflection, masks, etc, etc). I came up with a PS action which loaded the single images and arranged them in the same fashion as the master file.

But now PS doesn't load the incremental images for the batch processing.

Images are named in a Diffuse_00001, Specular_00001, ... fashion. Loading the first set works, but from Diffuse_00002 everything goes wrong and PS load the 00001 files (except from one file which loads in the proper incremental way).

I can't transfer this stuff to AE as it is much too complex and I do no AE only very little.

I guess PS should be capable to solve this batch task, but a simple action via batch seems to fail.

Anybody who knows a solution?

Cheers

Thomas

TOPICS
Actions and scripting

Views

3.3K

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

correct answers 1 Correct answer

Valorous Hero , May 04, 2009 May 04, 2009

Here is a basic outline (untested) it will need you to do a fancy Action to do what you want, at the moment the action will have to close all the four input files.

All the script will do is open 4 files one from each folder

Your action name and action set needs to be edited in the code

once your action has completed there should only be the file left to save, this will be saved as a png in the Renders folder and the file closed.

It will then repeat as abobe.

Hope it's a start for you.

//Select Renders

...

Votes

Translate

Translate
Adobe
New Here ,
Apr 21, 2009 Apr 21, 2009

Copy link to clipboard

Copied

I forgot to mention that after applying the action the comp is reduced to the background layer and needs to be saved as Flattened_00000,Flattened_00001, etc.

Cheers

Thomas

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 ,
Apr 22, 2009 Apr 22, 2009

Copy link to clipboard

Copied

No one? Is it so simple what I'm asking for? Is there another thread answering this question which I haven't come across?

Would be really cool if someone could at least send me into the right direction. On a 3D forum someone replied that I could use variables and data sets. Do know nothing about that. Is that a way to go?

Every help is appreciated!

Cheers

Thomas

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
Advisor ,
Apr 23, 2009 Apr 23, 2009

Copy link to clipboard

Copied

The following script will save a copy of the currently open document as the next in a sequence of documents. Options at the beginning let you flatten and resize the final doc as well as specify the filename prefix, output folder, and number of digits in the sequence number. This is a variant of a script that I frequently use for images that post online.

I haven't tested all of the features of this version, but it does work as is and should be suitable for inclusion in an Action and Batch run.

-X

//

// SeqSave

//

// This script saves the current document as a resized jpg to a

// hardwired folder.

//

// Copyright: (c)2009 xbytor

// License: http://creativecommons.org/licenses/LGPL/2.1

// Contact: xbytor@gmail.com

//

// $Id$

//

//@show include

//

//

//@includepath "/c/Program Files/Adobe/xtools;/Developer/xtools"

//

app;

//

Options = function(){};

Options.FOLDER = Folder.desktop + "/seqTest";
Options.PAD = 4;
Options.RESIZE = false;
Options.FLATTEN = true;
Options.MAX_WIDTH = 600;
Options.MAX_HEIGHT = 800;

Options.PREFIX = "Flattened_";   // defaults to date YYYYMMDD format

zeroPad = function(num, w) {
  var str = num.toString();

  while (str.length < w) {
    str = "0" + str;
  }
  return str;
};

getNextIndex = function(folder, prefix) {
  var idx = 0;
  var pad = Options.PAD;

  function _folderChk(f) {
    return (f instanceof File) && f.name.match(RegExp(prefix + "(\\d+)\\."));
  }

  var flist = folder.getFiles(_folderChk);
  if (flist && flist.length) {
    for (var i = 0; i < flist.length; i++) {
      var file = flist;
      var m = file.name.match(/(\d+)\.[^\.]+$/);
      if (m) {
        var v = Number(m[1]);
        if (v > idx) {
          idx = v;
          pad = m[1].length;
        }
      }
    }
  }

  idx++;
  return zeroPad(idx, pad);
};

function main() {
  if (app.documents.length == 0) {
    return;
  }

  var doc = app.activeDocument;
  doc.selection.selectAll();
  doc.selection.copy(doc.layers.length > 1);
  doc.selection.deselect();

  var prefix = Options.PREFIX;
  if (!prefix) {
    prefix = new Date().strftime("%Y%m%d-");
  }

  var folder = new Folder(Options.FOLDER);

  var idx = getNextIndex(folder, prefix);

  var fname = folder.absoluteURI + '/' + prefix + idx + '.jpg';
  var file = new File(fname);

  var saveOpts = new JPEGSaveOptions();
  saveOpts.quality = 8;

  var ru = app.preferences.rulerUnits;
  app.preferences.rulerUnits = Units.PIXELS;

  try {
    if (Options.RESIZE || Options.FLATTEN) {
      doc = doc.duplicate(file.name);
    }
    if (Options.FLATTEN) {
      doc.flatten();
    }
    if (Options.RESIZE) {
      PSfitImage(doc, Options.MAX_WIDTH, Options.MAX_HEIGHT);
    }

    if (!file.parent.exist) {
      file.parent.create();
    }

    doc.saveAs(file, saveOpts, false);
    doc.close(SaveOptions.DONOTSAVECHANGES);

  } catch (e) {
    alert(e.toString());

  } finally {
    app.preferences.rulerUnits = ru;
  }
};

cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };

PSfitImage = function(doc, width, height) {
  app.activeDocument = doc;
  var desc = new ActionDescriptor();
  desc.putUnitDouble( cTID('Wdth'), cTID('#Pxl'), width );
  desc.putUnitDouble( cTID('Hght'), cTID('#Pxl'), height );

  var fitId = sTID('3caa3434-cb67-11d1-bc43-0060b0a13dc4');
  return executeAction(fitId , desc, DialogModes.NO );
};

main();

"SeqSave.jsx";
// EOF

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 ,
Apr 23, 2009 Apr 23, 2009

Copy link to clipboard

Copied

Cooool! Thanks very much!

One part of the game is done. Now I just need to know how to open the image sequences incremental, batch process them and combine the save script with the whole thing and it would be done. Is the data set a way?

Cheers

Thomas

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 ,
May 01, 2009 May 01, 2009

Copy link to clipboard

Copied

Come on! Is my question to simple or to difficult? I have no idea?!

As this is the scripting forum, doesn't anybody can tell me which way I need to go to combine the loading of several incremental image sequences (one image at the time of each sequence) with a batch action and incremental saving?

Hope to get some feedback from the PS gods.

Cheers

Thomas

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
Valorous Hero ,
May 04, 2009 May 04, 2009

Copy link to clipboard

Copied

The problem here is that you haven't given enough information on what you require.

IE:

Are the files in the same folder or seperate folders?

What are the sequenced files called and what format are they?

Do the files just need to be opened or do they need stacking on top of each other in layers?

Do you need to run an action?

How should the file be saved, what format and where should they be saved?

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 ,
May 04, 2009 May 04, 2009

Copy link to clipboard

Copied

Light at the end of tunnel. Thanks for replying.

The files might be in a folder called "renders". "renders" contains several sub-folders, e.g. "diffuse", "specular", reflection", "alpha". Files within each folder will be named "diffuse_00001", "diffuse_00002", ...

There will be a recorded action (although I don't know how to deal with the _0000X extensions yet) which combines the loaded images ("diffuse_00001, specular_00001, ...) to a complicated layered file with many color corrections, in different folder structures (which might be masked also). After creating the layered file, the action will finally reduce everything to one layer with a transprency mask. I then want to save this file as a .png in the "renders" folder with names like "image_00001", "image_00002".

The initial files will be in 32bit (.hdr or .exr). During the action they will be reduced to 16bits or 8bits at one point.

This could be so simple by just being able to tell PS that the opened file "diffuse_00001" shall be replaced with "diffuse_00002" an so on after the action finished. But no, Adobe likes to keep things complicated (like the layer stacking, when do we get nodes???).

Hope this gives you the needed info.

In general:

open files x,y,z with the suffix _0000x, apply action to the stacked/layered files, save result as a, repeat action until end of sequence.

Thanks in advance

Thomas

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
Valorous Hero ,
May 04, 2009 May 04, 2009

Copy link to clipboard

Copied

Here is a basic outline (untested) it will need you to do a fancy Action to do what you want, at the moment the action will have to close all the four input files.

All the script will do is open 4 files one from each folder

Your action name and action set needs to be edited in the code

once your action has completed there should only be the file left to save, this will be saved as a png in the Renders folder and the file closed.

It will then repeat as abobe.

Hope it's a start for you.

//Select Renders Folder
var inputFolder = Folder.selectDialog("Please Select renders folder");
//Define folders
var diffuse = Folder(decodeURI(inputFolder + "/diffuse"));
var specularList = Folder(decodeURI(inputFolder + "/specularList"));
var reflection = Folder(decodeURI(inputFolder + "/reflection"));
var alpha = Folder(decodeURI(inputFolder + "/alpha"));
//Get list of files
var diffuseList=diffuse.getFiles(/\.(hdr|exr)$/i);
var specularList=specularList.getFiles(/\.(hdr|exr)$/i);
var reflectionList=reflection.getFiles(/\.(hdr|exr)$/i);
var alphaList=alpha.getFiles(/\.(hdr|exr)$/i);
//Create loop to open and process files
for(var a = 0;a<diffuseList.length;a++){
//Open all four files
open(diffuse);
open(specularList
);
open(reflection
);
open(alpha
);
//do your action enter name and action set
//At the moment the action will need to close the four f...


.name.match(/\d+/) + "png"));
//save as 24 bit png
SavePNG(saveFile);
//Close document
app.activeDocumen...










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 ,
May 13, 2009 May 13, 2009

Copy link to clipboard

Copied

LATEST

Thanks, Paul!

Except from two little mistakes it worked like charme.

Thank - you - very - 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