I have auto traced a photograph in illustrator - its got thousands of vectors once I expand it and illustrator has converted each of them to a filled colour - I want to now trace the edges of them with a grungy brush but using the underlying fill colour. Where in illustrator can I stroke or outline these fills using the underlying colour - surely this is something that the program automatically does?

I've found this script online but don't know how to implement it. I'm new to this so any help appreciated. Many thanks.


var idoc = app.activeDocument;  
var sel = idoc.selection;  

for (i=0; i<sel.length; i++) {  
    var ipath = sel[i];  
    ipath.stroked = true;  
    ipath.strokeColor = ipath.fillColor;  

Use of scripts is detailed in the Adobe Illustrator Help files:
A simple Google search for "How to use a script in Adobe Illustrator" or a search of the help files for "scripts" would have both turned up results.

To use that script (or any script for an Adobe application)....

  • Copy that script code to a text file
  • Save the text files as plain text (you can not use Word for this) and title it whatever you want adding a .jsx suffix. So the final file should be something like "AddStrokes.jsx"
  • Place your .jsx file into Adobe Illustrator CSx/Presets/[language]/Scripts
  • Relaunch Adobe Illustrator

Now open your artwork, select some objects and choose File > Scripts > AddStrokes (or whatever you titled your file).

For the record that script does function correctly. At least in Illustrator CS6.

  • Thank you for the answer. I did as suggested but it still seems to make the stroke lines a single colour (black) instead of taking the colour from the underlying fill colour of the selected shape. I'm new to illustrator (but familiar with AfterFX, PS and Premiere. – James Nov 5 '14 at 19:43
  • Sorry, when I try here it works exactly as expected -- stroking all objects with their existing fill color. – Scott Nov 5 '14 at 19:44
  • Thanks again for the feedback. Very kind of you and much appreciated. My workflow is as follows - import the picture - hit "image trace" (say 16 colours). Then hit "expand". Then "scripts/addstrokes" (no strokes appear). I'm a little stumped. Apologies for the idiocy. – James Nov 5 '14 at 20:25
  • @James When tracing ensure you use the Overlap Method (i.stack.imgur.com/2bRGm.jpg) then you must expand and then ungroup for the script to function on a tracing. It appears as though the script will not function on compound paths or groups, hence the overlap method and ungrouping. – Scott Nov 6 '14 at 5:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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