Skip to main content
Participating Frequently
June 3, 2020
Question

Brush color dynamics applying the same color when stroking down multiple paths

  • June 3, 2020
  • 2 replies
  • 1619 views

I have a few different paths that I am trying to make different colors when applying a stroke to them. 

 

However, if I have multiple paths selected and stroke the paths with a brush that has foreground/background jitter on it, it will apply the same color to all of them.

If I just use the brush on its own I get color variation as expected. 

 

Is there any way to apply this color variation when selecting multiple paths? I have a lot of them so it doesn't make sense to do it by hand. 

This topic has been closed for replies.

2 replies

Participating Frequently
June 4, 2020

Ok, I started on a script to loop through the subpaths but I'm not experienced with scripting in Photoshop.

Here is what I've got so far, but it is throwing errors:

 

var doc = app.activeDocument;

var subpaths = doc.pathItems.getByName('path').subPathItems; // subpaths of a specific path

for(var i=0;i<subpaths.length;i++){

    doc.subpaths[i].StrokePath(ToolType.BRUSH); // Is there a way to do a specific Brush?
}

 

Participating Frequently
June 4, 2020

So turns out the StrokePath command only works on paths, and not subpaths.

I wrote this script to go through all the subpaths turn them into a path and then stroke them individually.

It works but there are a few issues:
-it runs much slower than I might hope

-I want to be able to tell it which brush/settings to use when it stokes a path // haven't found any info on this in my searching
 (A known workaround would be to assign it an action that uses a specific brush for a path stroke, but I would like to handle it in the script if possible)

Any ideas/suggestions would be appreciated.

 

 

var doc = app.activeDocument

var topPath = doc.pathItems.getByName('top')

var topSubPath = topPath.subPathItems

for(var i=0;i<topSubPath.length;i++){ //Loop through SubPaths and Stroke them 1 by 1

	//can't run strokePath on subpaths, so need to convert them to temporary paths 
	
	var tempPoints = topSubPath[i].pathPoints
	
	var tempArray = new Array()
	
	for (var p=0;p<tempPoints.length;p++){
		tempArray[p] = new PathPointInfo
		tempArray[p].kind = tempPoints[p].kind
		tempArray[p].anchor = tempPoints[p].anchor
		tempArray[p].leftDirection = tempPoints[p].leftDirection
		tempArray[p].rightDirection = tempPoints[p].rightDirection
	}
	
	var tempSubPathArray = new Array()
	tempSubPathArray[0] = new SubPathInfo()
	tempSubPathArray[0].operation = ShapeOperation.SHAPEXOR
	tempSubPathArray[0].closed = false
	tempSubPathArray[0].entireSubPath = tempArray
	
	var tempname = "temp" + i
	var tempPathItem = doc.pathItems.add(tempname, tempSubPathArray)
	
	var tempname = "temp" + i
	var tempPath = doc.pathItems.getByName(tempname)

	tempPathItem.strokePath(ToolType.BRUSH)
	doc.pathItems.getByName(tempname).remove()
}

 

 

 

Bojan Živković11378569
Community Expert
Community Expert
June 3, 2020

Beside Photoshop action I can not think any other solution at the moment. Action can select paths in the Paths panel: Path 1, Path 2 and so on... to change Foreground color and to stroke path.

Participating Frequently
June 3, 2020

Hmmm, Ideally I would be able to keep the sub-paths all grouped as paths and be able to apply the brush stroke to each subpath individually. Is there a way I could loop through all the selected sub-paths using a script?

Bojan Živković11378569
Community Expert
Community Expert
June 3, 2020

I can not help with spcripts woaoit till guys see this thread.