Clone strokes detection

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

Mike Hale

Clone strokes detection

Post by Mike Hale »

The code I posted already shows it is possible to switch documents, set the clone source, then switch back so that is possible.

You can get the current foreground color with app.foregroundColor, so that is also possible.

I can't say if it's possible to change the hue of a document to match the foreground color as I am not sure how you want to do that. If you want to add a solid fill adjustment layer to the top of the layer stack and set it's color to the foreground color and blend mode to hue, then yes that can be scripted. If you have a different way to change the hue outline the method used and I can give a better answer as to if it can be scripted.

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

getInteger

Clone strokes detection

Post by getInteger »

I'm not sure yet about the way i will change hue.
Could you please give me some basic code doing the stuffs that i could edit.
Mike Hale

Clone strokes detection

Post by Mike Hale »

I'm not sure what code to suggest for changing the hue of a document unless I know how you want to do that.

As for the rest of the steps, I have already posted how to do those.
getInteger

Clone strokes detection

Post by getInteger »

I want to make a complete hue change on all the layer.
For example,if i have as foreground color e83434, and a grass picture (global hue = 507447) then i want the grass layer to have its global hue become e83434.
But maybe your idea is better, instead of directly editing the layer, creating an adjustment layer and edit and reset (delete?) this layer each time the script is launched.
What do you think is best ?
Mike Hale

Clone strokes detection

Post by Mike Hale »

This will add a color fill layer with the blend mode set to hue at the top of the layer stack. That should change the hue of all the layers.
Code: Select allfunction makeSolidFillAdjLayer(solidColor) {
    var desc = new ActionDescriptor();
        var adjLayer = new ActionReference();
        adjLayer.putClass( stringIDToTypeID('contentLayer') );
    desc.putReference( charIDToTypeID('null'), adjLayer );
        var fill = new ActionDescriptor();
            var sc = new ActionDescriptor();
                var color = new ActionDescriptor();
                color.putDouble( charIDToTypeID('Rd  '), solidColor.rgb.red );
                color.putDouble( charIDToTypeID('Grn '), solidColor.rgb.green );
                color.putDouble( charIDToTypeID('Bl  '), solidColor.rgb.blue );
            sc.putObject( charIDToTypeID('Clr '), charIDToTypeID('RGBC'), color );
        fill.putObject( charIDToTypeID('Type'), stringIDToTypeID('solidColorLayer'), sc );
    desc.putObject( charIDToTypeID('Usng'), stringIDToTypeID('contentLayer'), fill );
    executeAction( charIDToTypeID('Mk  '), desc, DialogModes.NO );
};
app.activeDocument.activeLayer = app.activeDocument.layers[0];
makeSolidFillAdjLayer(app.foregroundColor);
app.activeDocument.activeLayer.blendMode = BlendMode.HUE;
getInteger

Clone strokes detection

Post by getInteger »

Thanks