• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Extendscript: Unexpected compound shape / path results from expanding image trace

New Here ,
May 23, 2023 May 23, 2023

Copy link to clipboard

Copied

I am writing a script in Extendscript for adobe illustrator that would automate these steps for an ink like effect: 1)Expand the selected object 2)convert to a compound shape 3)apply gaussian blur 4)rasterize 5)image trace. Here is how this looks when done manually:

 

Before doing the steps manually:

Screenshot_1.png

after doing the steps manually ( you can see a slight rounding effect, that is what is intended):

Screenshot_2.png

However, when running these steps from my script, i get a different result:

after result from script:

Screenshot_3.png

it seems like the compound shape is being released.

The rounded effect applied as was expected, but the empty spaces in paths always turn out filled. As if the script was releasing the compound path.

I am wondering where in the script this could be happening, and how to prevent that ?

Here is the code for the function where the effect is being applied:

function mainFunction(){
        inkifyScript.selection = app.activeDocument.selection;
        
        if (inkifyScript.selection.length > 0){
    
            app.executeMenuCommand('group');
            inkifyScript.xmlString = '<LiveEffect name="Adobe PSL Gaussian Blur"><Dict data="R blur '+ 20 +'"/></LiveEffect>';
            for (var i = 0; i < inkifyScript.selection.length; i++){
                inkifyScript.selection[i].applyEffect(inkifyScript.xmlString);
            }
            
            inkifyScript.raster = app.activeDocument.rasterize(selection[0]);
            inkifyScript.raster.selected = true;

            inkifyScript.pluginItem = inkifyScript.raster.trace();

            inkifyScript.tracingOptions = inkifyScript.pluginItem.tracing.tracingOptions;
            inkifyScript.tracingOptions.tracingMode = TracingModeType.TRACINGMODEBLACKANDWHITE;
            inkifyScript.tracingOptions.ignoreWhite = true;
            inkifyScript.tracingOptions.fills = true;
            inkifyScript.tracingOptions.maxColors = 2;
            inkifyScript.tracingOptions.threshold = 142;
            inkifyScript.tracingOptions.pathFitting = 10;
            app.redraw();
            inkifyScript.pluginItem.tracing.expandTracing();    
        }
        
    }`
TOPICS
Scripting

Views

372

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , May 23, 2023 May 23, 2023

To correctly ignore white, you must use tracingMethod attribute.

 

tracingOptions.tracingMethod = TracingMethodType.TRACINGMETHODABUTTING;
tracingOptions.ignoreWhite = true;

 

 

Votes

Translate

Translate
Adobe
Enthusiast ,
May 23, 2023 May 23, 2023

Copy link to clipboard

Copied

To correctly ignore white, you must use tracingMethod attribute.

 

tracingOptions.tracingMethod = TracingMethodType.TRACINGMETHODABUTTING;
tracingOptions.ignoreWhite = true;

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 23, 2023 May 23, 2023

Copy link to clipboard

Copied

LATEST

This solved the issue, thank you ! 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines