Last active
November 3, 2018 15:37
-
-
Save jhorikawa/0434f0b3a684b71f065604e9da9b4250 to your computer and use it in GitHub Desktop.
Illustrator javascript to open image for image tracing.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var folderPath = "~/Desktop"; | |
var fileName = "scanned.png"; | |
var saveName = "scanned.svg"; | |
var filePath = new File(folderPath + fileName); | |
open(filePath); | |
var rItems = activeDocument.rasterItems; | |
for(var i = 0; i<rItems.length; i++){ | |
var trObj = rItems[i].trace().tracing; | |
trObj.tracingOptions.loadFromPreset("6 Colors"); | |
trObj.expandTracing(); | |
} | |
redraw(); | |
var saveFile = new File(folderPath + saveName); | |
var svgOption = new ExportOptionsSVG(); | |
svgOption.coordinatePrecision = 7; | |
activeDocument.exportFile(saveFile,ExportType.SVG,svgOption); | |
activeDocument.close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment