Skip to main content
Participating Frequently
December 27, 2016
Question

Image trace in js script

  • December 27, 2016
  • 2 replies
  • 4790 views

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?

This topic has been closed for replies.

2 replies

Om Nath Jha
Legend
May 25, 2017

Moving to Illustrator Scripting​ for further assistance.

Regards,

Om

Ray Yorkshire
Participating Frequently
December 27, 2016

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 ?

Participating Frequently
December 28, 2016

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.

Larry G. Schneider
Community Expert
Community Expert
December 28, 2016

You might try asking in the Illustrator Scripting Forum, one door down.