1

I have a file with several layers that need to be created with very minor differences in hue and saved.

I've created this example for simplicity.

I have 2 layers 1 with a red circle, and 1 with a blue circle. Each of those layers has a hue/saturation adjustment layer clipped to them currently with no changes.

enter image description here

Is it possible to automate a small change to the hue value (and not necessarily by the same values) and save the file, doing this in bulk until I had values for each possible hue?

1 Answer 1

1

Actions don't have iterators hence can't set values based on iterators, so you'll need a script to drive the loop. However scripts can call actions, so the script can be quite simple and contain only the looping part and saving part (because we need to use the loop in the save name).

Important part here is to figure out how Action would look like. There could be different options here, one of them is to have Hue/Sat layers with the offsets you want and duplicate them in each loop. This way each new Hue/Sat will add a new hue shift. In this scenario the action would look like this (starts from a selected Hue/Sat layer):

  1. Layer via copy active (Hue/Sat) layer
  2. Create clipping mask
  3. Select the other Hue/Sat
  4. Layer via copy
  5. create clipping mask
  6. Select the original Hue/Sat

so this action will create a copy of each Hue/Sat layer. Next, let's say your first Hue/Sat has an offset of 60 and the second has 30. So the script will need to loop 360/30 = 12 times before creating all possible combinations. Loop will look like this:

function main()
{
  var min_offset = 30; // the minimum offset
  var loops_count = 360 / min_offset; // getting the number of loops, 12 in the example
  var save_path = '/D/my/export/folder'; // set the save path like /DRIVE_LETTER/path/to/folder
  var i;

  // if save path doesn't exist, abort
  if (!new Folder(save_path).exists)
  {
    alert(new Folder(save_path).fsName + " doesn't exist, aborting");
    return false;
  }

  for (i = 0; i < loops_count; i++)
  {
    app.doAction("Action_Name", "My_Set"); // this will call an Action_Name from My_Set

    // save a a document as PNG
    var options = new ExportOptionsSaveForWeb();
    pngFile = new File(save_path + '/my_file_' + (i+1) + '.png');
    options.format = SaveDocumentType.PNG;
    options.PNG8 = false;
    activeDocument.exportDocument(pngFile, ExportType.SAVEFORWEB, options);
  }
}
main();

result:

enter image description here

1
  • I'll give this a shot, thanks! Commented May 9, 2020 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.