// illustrator-batch-svg-to-eps.jsx // Free script from LinearAndLoom Icons: https://linearandloomicons.netlify.app/scripts/ // Provided as is. Try it on a copy of your files first. /* SVG to EPS for Shutterstock - Adobe Illustrator script ------------------------------------------------------------ Shutterstock accepts vectors as EPS only (Illustrator 8 or 10 compatible, 4-25 MP). This script saves at the size the SVG already has. Size your artboards under 25 MP first, and convert text to outlines. HOW TO RUN Illustrator: File > Scripts > Other Script... > choose this file. Pick the folder that contains your .svg files (or any parent folder). WHAT IT DOES - Finds every .svg in the chosen folder and its subfolders. - Saves each one as an Illustrator 10 compatible EPS in a folder named "EPS" next to the SVG files, with the same file name (so the CSV metadata matches). - Opens and saves as-is: nothing in the artwork is changed. Original SVGs are never modified. - Existing EPS files are skipped, so it is safe to run again. */ #target illustrator (function () { var root = Folder.selectDialog("Select the folder with the SVG files"); if (!root) { return; } var previousLevel = app.userInteractionLevel; app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS; var converted = 0, skipped = 0, failed = []; function epsOptions() { var o = new EPSSaveOptions(); o.compatibility = Compatibility.ILLUSTRATOR10; o.preview = EPSPreview.COLORTIFF; o.embedAllFonts = true; o.embedLinkedFiles = true; o.includeDocumentThumbnails = true; o.cmykPostScript = false; o.postScript = EPSPostScriptLevelEnum.LEVEL2; return o; } function walk(folder) { var items = folder.getFiles(), svgs = [], i; for (i = 0; i < items.length; i++) { var it = items[i]; if (it instanceof Folder) { var n = it.name.toLowerCase(); if (n !== "eps" && n !== "illustrator" && n !== "__macosx" && n.charAt(0) !== ".") { walk(it); } } else if (/\.svg$/i.test(it.name) && it.name.charAt(0) !== ".") { svgs.push(it); } } if (!svgs.length) { return; } var out = new Folder(folder.fsName + "/EPS"); if (!out.exists) { out.create(); } for (i = 0; i < svgs.length; i++) { var target = new File(out.fsName + "/" + decodeURI(svgs[i].name).replace(/\.svg$/i, ".eps")); if (target.exists) { skipped++; continue; } var doc = null; try { doc = app.open(svgs[i]); doc.saveAs(target, epsOptions()); doc.close(SaveOptions.DONOTSAVECHANGES); converted++; } catch (e) { failed.push(decodeURI(svgs[i].name) + " (" + e + ")"); try { if (doc) { doc.close(SaveOptions.DONOTSAVECHANGES); } } catch (e2) {} } } } try { walk(root); } finally { app.userInteractionLevel = previousLevel; } var msg = "SVG to EPS - finished\n\nConverted: " + converted + "\nAlready existed (skipped): " + skipped + "\n"; if (failed.length) { msg += "\nCould not convert " + failed.length + ":\n" + failed.slice(0, 15).join("\n"); } alert(msg); })();