Mobile app version of vmapp.org
Login or Join
Ann6370331

: Is there a way to automate changing the hue of many layers with a different value per layer? Let's say I have 100 photos in a folder. On the first one, I would like to change the Hue to

@Ann6370331

Posted in: #Actions #AdobePhotoshop #Automation #BatchProcessing

Let's say I have 100 photos in a folder. On the first one, I would like to change the Hue to -180, and save it. On the second one, I would like to change the Hue to -170. On the third one, I would like to change the Hue to -160, and so on.

Is there a way to batch process with a different value each time?

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Ann6370331

3 Comments

Sorted by latest first Latest Oldest Best

 

@Cody3331749

I have a script that will do just that. Just save it as something like changeHuePerLayer.jsx and drag and drop it on top the Photoshop dock icon on the Mac. On Windows I think you need to open it from the menu (not sure where).
#target photoshop
app.bringToFront();

var
LOWER_HUE_LIMIT = -180,
UPPER_HUE_LIMIT = 180;
var
hueValue = LOWER_HUE_LIMIT,
hueIncrementor = 10,
currentDoc = app.activeDocument;


for ( var i = 0; i < currentDoc.layers.length; i++ ) {
currentDoc.activeLayer = currentDoc.layers[i];
hueValue = hueValue < UPPER_HUE_LIMIT ? hueValue + hueIncrementor : LOWER_HUE_LIMIT;
applyHsl( hueValue, 0, 0 );
}


/**
*
* @param {number} hue
* @param {number} saturation
* @param {number} lightness
*/
function applyHsl( hue, saturation, lightness ) {
var HUE_SAT_ADJUSTMENT_V2_SYM = 'Hst2';
var COLORIZE_SYM = 'Clrz';
var ADJUSTMENT_SYM = 'Adjs';
var HUE_SYM = 'H ';
var SATURATION_SYM = 'Strt';
var LIGHTNESS_SYM = 'Lght';
var HUE_SATURATION_SYM = 'HStr';

var colorizeDescriptor = new ActionDescriptor();
var hueSatDescriptor = new ActionDescriptor();
var hueSatAdjustmentList = new ActionList();

colorizeDescriptor.putBoolean( charIDToTypeID( COLORIZE_SYM ), false );

hueSatDescriptor.putInteger( charIDToTypeID( HUE_SYM ), hue );
hueSatDescriptor.putInteger( charIDToTypeID( SATURATION_SYM ), saturation );
hueSatDescriptor.putInteger( charIDToTypeID( LIGHTNESS_SYM ), lightness );

hueSatAdjustmentList.putObject( charIDToTypeID( HUE_SAT_ADJUSTMENT_V2_SYM ), hueSatDescriptor );
colorizeDescriptor.putList( charIDToTypeID( ADJUSTMENT_SYM ), hueSatAdjustmentList );

executeAction(
charIDToTypeID( HUE_SATURATION_SYM ),
colorizeDescriptor,
DialogModes.NO
);
}

10% popularity Vote Up Vote Down


 

@Pierce403

I'd probably use ImageMagick.

There is a feature available to modify the hue, but it's percentage based instead of degrees.


Hue Modulation

Rotates the colors of the image, in a cyclic manner. To achieve this the Hue value given produces a 'modulus addition', rather than a multiplication.
However be warned that the hue is rotated using a percentage, and not by an angle.

convert rose: -modulate 100,100,0 mod_hue_0.gif
convert rose: -modulate 100,100,33.3 mod_hue_33.gif
convert rose: -modulate 100,100,66.6 mod_hue_66.gif
convert rose: -modulate 100,100,100 mod_hue_100.gif
convert rose: -modulate 100,100,133.3 mod_hue_133.gif
convert rose: -modulate 100,100,166.6 mod_hue_166.gif
convert rose: -modulate 100,100,200 mod_hue_200.gif


Result:




Most of the heavy lifting is done for you in that example, you would just need to create a script that indexes all the files in a directory and applies a sequential value given to the modulate argument.

10% popularity Vote Up Vote Down


 

@Connie430

This could be accomplished with PS scripting. As it is a pretty unique request, you might have trouble finding an existing script that does that. You'd probably either have to code it up yourself or hire someone who can do it for you.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme