Copy link to clipboard
Copied
Hi!
I'm trying to trace a PNG image in Adobe Illustrator via js script. I've tried different approaches, but always have the same problem - I can't change Color setting automatically. Here is my simple script:
thisImage.tracing.tracingOptions.tracingMethod = TracingMethodType.TRACINGMETHODABUTTING;
thisImage.tracing.tracingOptions.tracingMode = TracingModeType.TRACINGMODECOLOR;
thisImage.tracing.tracingOptions.cornerFidelity = 50;
thisImage.tracing.tracingOptions.pathFidelity = 55;
thisImage.tracing.tracingOptions.noiseFidelity = 5;
thisImage.tracing.tracingOptions.maxColors = 40;
thisImage.tracing.tracingOptions.colorFidelity = 50;
app.redraw();
So other parameters were changed during this script execution (Paths, Corners, Noise), but Colors is 100 again despite maxColors and colorFidelity. And I don't see any additional fields in tracing options that can be responsible for this.
Could you please give me any advise how to solve this issue?
Copy link to clipboard
Copied
I'm just learning
What's the advantage here to making a Script
vs making an Action with those image trace settings added via a preset ?
Copy link to clipboard
Copied
I need to run this script in command line. So, I want to run it like "illustrator.exe trace.js", Illustrator opens my image, trace it and save the result. In case of actions, I need to use GUI.
By the way, traceOptions has the method to load preset, but for some reason when I load my preset in script - I have another issue. My palette switches to Limited palette with 30 max colors. So I can't use preset in js script.
Copy link to clipboard
Copied
You might try asking in the Illustrator Scripting Forum, one door down.
Copy link to clipboard
Copied
What is "traceOptions"? I wasn't able to find a script by that name online.
I'm looking for a Script or Action solution to run more than one image trace preset in a single file.
Copy link to clipboard
Copied
traceOptions is just the name of the attributes in JS, not a particular script.
Copy link to clipboard
Copied
Actions do not recognize Image Trace Presets. It simply runs the default preset.
Copy link to clipboard
Copied
Thanks, Doug. Showing my lack of JS knowledge. I'll poke around and see what I can learn about it.
Copy link to clipboard
Copied
i keep a copy of the scripting reference on hand to, er, reference.
though i'm no real scripter, it's useful to know what's possible and get familiar with the vocabulary.
Copy link to clipboard
Copied