Skip to main content
Flowgun
Inspiring
November 12, 2025
Question

script to change Live Paint object Stroke width?

  • November 12, 2025
  • 4 replies
  • 235 views

Hello everyone,
I'm trying to write a script that increases or decreases the width of strokes on shapes.
for now, what I came up with (found mostly on the internet a while ago), works fine for most shapes, and it can recurse into containers like groups, read their stroke width, and increase it by a certain percentage.

The problem remains with Live paint objects. I can't figure how to read their stroke width or how to change it. Any help would be appreciated!

4 replies

Kurt Gold
Community Expert
November 13, 2025

If you don't mind to use helper graphic styles, you may check this sample Illustrator file:

 

Live Paint - Scale Strokes

 

Using this snippet will scale the strokes of selected Live Paint objects by 200 %:

 

(function () {
    var doc = app.activeDocument;
    var sel = doc.selection;
    var style = doc.graphicStyles.getByName("Scale_Live_Paint_Strokes_By_200_Percent");
    for (var i = 0; i < sel.length; i++) style.applyTo(sel[i]);
})();

 

That would also work with an action or by just applying the graphic style manually (fastest method).

 

Kurt Gold
Community Expert
November 13, 2025

I haven't tried it yet, but perhaps one may be able to script the following manual steps (possibly assisted by Mark's (m1b) LE_Functions suite):

 

- Select one or several Live Paint objects.

 

- Effect menu > Distort and Transform > Transform:

  • Set a scaling percentage
  • In the Options panel select only the Transform Patterns and the Scale Strokes & Effects option
m1b
Community Expert
November 14, 2025

That seems like a good approach Kurt. I like that it doesn't interfere with the live paint object itself.

- Mark

m1b
Community Expert
November 13, 2025

I've been waiting... hoping!... for someone to post an answer here, but I should tell you that as far as I know the scripting API doesn't expose much of the live paint object, if any. 😞

 

Edit: sorry didn't see Sergey's post.

Sergey Osokin
Inspiring
November 13, 2025

Because Live Paint, like Compound Shape for scripts, is an "unknown" container of PluginItem. But from the outside, it's a PluginItem, and inside it's a GroupItem, which already has script access if you select one path with the Direct Selection Tool.

I tried this trick (check out video) on Live Paint but discovered another problem:

  1. When creating Live Paint, Illustrator resets the stroke widths of all internal paths to 0.5 pt, and we only see the stroke width (appearance) of the common container.
  2. When changing the stroke widths of the internal Live Paint paths via script, it breaks — the colors disappeared, and the stroke changed to a round cap. This is one of the clearest examples of the limitations and lack of progress in ExtendScript.

 

CarlosCanto
Community Expert
November 13, 2025

this seems to work well, all colors and stroke size are preserved

 

// scale Live Paint Stroke

function main() {
    app.executeMenuCommand("Expand Planet X");

    selection[0].resize (100, 100, true, true, true, true, 200, Transformation.CENTER); // scale strokes

    app.executeMenuCommand("Make Planet X")
}
main();
m1b
Community Expert
November 13, 2025

Not bad Carlos!