// illustrator-batch-eps-to-jpg.jsx // Free script from LinearAndLoom Icons: https://linearandloomicons.netlify.app/scripts/ // Provided as is. Try it on a copy of your files first. /* EPS to JPG - Adobe Illustrator script ------------------------------------------------------------ Converts every .eps file in a folder to a JPG at the resolution you choose (300 DPI by default). JPGs are saved next to the EPS files with the same names, including names with spaces. Original EPS files are never modified. HOW TO RUN Illustrator: File > Scripts > Other Script... > choose this file. 1. Pick the folder that contains the .eps files. 2. Type the resolution, or press OK for 300 DPI. */ #target illustrator function convertEPStoJPG() { var inputFolder = Folder.selectDialog("Select folder with EPS files"); if (!inputFolder) return; var dpi = prompt("Enter output resolution (DPI):", "300"); if (dpi === null) return; dpi = parseFloat(dpi); if (isNaN(dpi) || dpi <= 0) dpi = 300; var epsFiles = inputFolder.getFiles(/\.eps$/i); if (epsFiles.length === 0) { alert("No EPS files found."); return; } var successCount = 0; var errorCount = 0; var originalUserLevel = app.userInteractionLevel; app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS; for (var i = 0; i < epsFiles.length; i++) { var epsFile = epsFiles[i]; var doc = null; try { doc = app.open(epsFile); if (doc.documentColorSpace != DocumentColorSpace.RGB) { doc.documentColorSpace = DocumentColorSpace.RGB; } var scale = (dpi / 72) * 100; // Illustrator's JPEG export cannot scale above 776.19 % (about 558 DPI) if (scale > 776.19) { scale = 776.19; } var jpegOptions = new ExportOptionsJPEG(); jpegOptions.quality = 100; jpegOptions.horizontalScale = scale; jpegOptions.verticalScale = scale; jpegOptions.optimization = true; jpegOptions.embedColorProfile = true; jpegOptions.antiAliasing = true; jpegOptions.artBoardClipping = true; // original filename without extension var originalName = epsFile.displayName.replace(/\.eps$/i, ""); // Illustrator will create dashed filename var dashedName = originalName.replace(/ /g, "-"); var tempJpgFile = new File(inputFolder.fsName + "/" + dashedName + ".jpg"); // export doc.exportFile(tempJpgFile, ExportType.JPEG, jpegOptions); // rename back to original with spaces tempJpgFile.rename(originalName + ".jpg"); successCount++; doc.close(SaveOptions.DONOTSAVECHANGES); } catch (e) { errorCount++; if (doc) { try { doc.close(SaveOptions.DONOTSAVECHANGES); } catch (err) {} } $.writeln("Error: " + epsFile.name + " -> " + e.toString()); } } app.userInteractionLevel = originalUserLevel; alert( "Conversion finished.\n" + "Successful: " + successCount + "\n" + "Errors: " + errorCount ); } convertEPStoJPG();