Batch convert EPS/AI to PNG using Javascript

Hi,
I have lots of eps and ai files which I would like to convert to PNG format. The reason for doing this is to make it easier to find the image that I want instead of opening it one by one. I know Photoshop can do the conversion but limited to JPG, PSD and TIFF only. The filesize also will be so huge and the image quality is not sharp.
One of the preset scripts for Adobe CS3 is SaveDocsAsPDF. I tried using this and then convert the PDF to PNG using Acrobat. I would required too much time to do it. I think there might be a better way to achieve the same result.
I am not a programmer and cant figure out how to tweak the SaveDocsAsPDF script and become SaveDocsAsPNG script.
It would be great if I can just select the folder and all the conversion will be done in the backgroud.
Anyone can help me?
Thanks

ADOBE SYSTEMS INCORPORATED
Copyright 2005 Adobe Systems Incorporated
All Rights Reserved
NOTICE:  Adobe permits you to use, modify, and
distribute this file in accordance with the terms
of the Adobe license agreement accompanying it. 
If you have received this file from a source
other than Adobe, then your use, modification,
or distribution of it requires the prior
written permission of Adobe.
ExportDocsAsPNG24.js
DESCRIPTION
This sample gets files specified by the user from the
selected folder and batch processes them and saves them
as PDFs in the user desired destination with the same
file name.
// Main Code [Execution of script begins here]
// uncomment to suppress Illustrator warning dialogs
// app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
var destFolder, sourceFolder, files, fileType, sourceDoc, targetFile, pngExportOpts;
// Select the source folder.
sourceFolder = Folder.selectDialog( 'Select the folder with Illustrator files you want to convert to PNG', '~' );
// If a valid folder is selected
if ( sourceFolder != null )
    files = new Array();
    fileType = prompt( 'Select type of Illustrator files to you want to process. Eg: *.ai', ' ' );
    // Get all files matching the pattern
    files = sourceFolder.getFiles( fileType );
    if ( files.length > 0 )
        // Get the destination to save the files
        destFolder = Folder.selectDialog( 'Select the folder where you want to save the converted PNG files.', '~' );
        for ( i = 0; i < files.length; i++ )
            sourceDoc = app.open(files[i]); // returns the document object
            // Call function getNewName to get the name and file to save the png
            targetFile = getNewName();
            // Call function getPNGOptions get the PNGExportOptions for the files
            pngExportOpts = getPNGOptions();
            // Export as PNG
            sourceDoc.exportFile( targetFile, ExportType.PNG24, pngExportOpts );
            sourceDoc.close(SaveOptions.DONOTSAVECHANGES);
        alert( 'Files are saved as PNG in ' + destFolder );
    else
        alert( 'No matching files found' );
getNewName: Function to get the new file name. The primary
name is the same as the source file.
function getNewName()
    var ext, docName, newName, saveInFile, docName;
    docName = sourceDoc.name;
    ext = '.png'; // new extension for png file
    newName = "";
    for ( var i = 0 ; docName[i] != "." ; i++ )
        newName += docName[i];
    newName += ext; // full png name of the file
    // Create a file object to save the png
    saveInFile = new File( destFolder + '/' + newName );
    return saveInFile;
getPNGOptions: Function to set the PNG saving options of the
files using the PDFSaveOptions object.
function getPNGOptions()
    // Create the PDFSaveOptions object to set the PDF options
    var pngExportOpts = new ExportOptionsPNG24();
    // Setting PNGExportOptions properties. Please see the JavaScript Reference
    // for a description of these properties.
    pngExportOpts.antiAliasing = true;
    pngExportOpts.artBoardClipping = true;
    //pngExportOpts.horizontalScale = 100.0;
    //pngExportOpts.matte = true;
    //pngExportOpts.matteColor = 0, 0, 0;
    pngExportOpts.saveAsHTML = false;
    pngExportOpts.transparency = false;
    //pngExportOpts.verticalScale = 100.0;
    return pngExportOpts;
Copy the above and paste into a text editor or the ESTK and save (from the text editor be sure to save as plain text). Place it into HD/Applications/Adobe Illustrator CS6/Presets/en_US/Scripts. Restart AI.

Similar Messages

  • Batch convert EPS files to PNG

    I have many eps files which I need to open in Fireworks, select the items, apply script commaneds and save back down again as PNG's. I need to retain the vector graphics and layers.
    Problem is the Fireworks Batch tool doesn't recognise eps files so I can't run them through this.
    Has anyone got a solution for this?
    Thanks for your help.

    I have many eps files which I need to open in Fireworks, select the items, apply script commaneds and save back down again as PNG's. I need to retain the vector graphics and layers.
    Problem is the Fireworks Batch tool doesn't recognise eps files so I can't run them through this.
    Has anyone got a solution for this?
    Thanks for your help.

  • How to batch convert .eps into .ai files?

    Hi everyone
    I have over the years gathered a huge asset library of all kinds of graphic design assets. Now I need to put this into a system and I want to use Bridge since I'm a freelancer and can't afford another system (my library is over 40GB).
    My problem is that lots of the files are in .eps format (bought in bundles etc.) and I can't stick keywords and more on them in Bridge.
    So I've been looking all over the internet for the last two hours trying to find a way to batch convert 100's (if not 1000's) of .eps files into .ai format (preferably the CS4 version - I got Creative Cloud, but I also work in CS4 with some clients still).
    I have not found an answer I can use yet Some talk about a script and show lines of code, but I don't know how to create/make/save/install a script from pure text so it does not help me.
    Preferably it would be possible for me to make a folder called "eps" and a folder called "ai" and then just put every file into the "eps" folder and then I can sort them afterwards.
    Does anyone know a solution to my problem?
    In advance thanks for all help and suggestions
    - Kenneth

    Try
    GraphicsMagick.

  • Batch convert EPS to AI?

    I have created the action but there is no batch like it is in Photoshop. How can I batch convert a folder of EPS files to AI?
    Thanks,

    The Batch process you are looking for is located in the Flyout menu of the Actions Palette.

  • Help with Illustrator Script! Batch convert files including subfolders - please help! :)

    Hello,
    I honestly have tried reading the other answers and researching to try to solve this problem.  I'm sorry for my ignorance in this area.  Please help!!!
    I'm trying to make a script (for Illustrator CS2) that will batch convert several files to PNG files.  The source folder has several subfolders and I need the script to go into the subfolders and convert those files as well.  The destination directory should be an entirely separate folder but with the same hierarchy as the original source folder.
    The script I have been using (that converts just as I need) is below.  The only problem is it doesn't do the subfolders.
    Any help would be so amazingly appreciated!
    ADOBE SYSTEMS INCORPORATED
    Copyright 2005 Adobe Systems Incorporated
    All Rights Reserved
    NOTICE:  Adobe permits you to use, modify, and
    distribute this file in accordance with the terms
    of the Adobe license agreement accompanying it. 
    If you have received this file from a source
    other than Adobe, then your use, modification,
    or distribution of it requires the prior
    written permission of Adobe.
    ExportDocsAsPNG24.jsx
    DESCRIPTION
    This sample gets files specified by the user from the
    selected folder and batch processes them and saves them
    as PNGs in the user desired destination with the same
    file name.
    // Main Code [Execution of script begins here]
    // uncomment to suppress Illustrator warning dialogs
    // app.userInteractionLevel =
    UserInteractionLevel.DONTDISPLAYALERTS;
    var destFolder, sourceFolder, files, fileType,
    sourceDoc, targetFile, pngExportOpts;
    // Select the source folder.
    sourceFolder = Folder.selectDialog( 'Select the folder
    with Illustrator files you want to convert to PNG', '~'
    // If a valid folder is selected
    if ( sourceFolder != null )
        files = new Array();
        fileType = prompt( 'Select type of Illustrator files
    to you want to process. Eg: *.ai', ' ' );
        // Get all files matching the pattern
        files = sourceFolder.getFiles( fileType );
        if ( files.length > 0 )
            // Get the destination to save the files
            destFolder = Folder.selectDialog( 'Select the
    folder where you want to save the converted PNG files.',
    '~' );
            for ( i = 0; i < files.length; i++ )
                sourceDoc = app.open(files[i]); // returns
    the document object
                // Call function getNewName to get the name
    and file to save the pdf
                targetFile = getNewName();
                // Call function getPNGOptions get the
    PNGExportOptions for the files
                pngExportOpts = getPNGOptions();
                // Export as PNG
                sourceDoc.exportFile( targetFile,
    ExportType.PNG24, pngExportOpts );
                sourceDoc.close
    (SaveOptions.DONOTSAVECHANGES);
            alert( 'Files are saved as PNG in ' + destFolder
        else
            alert( 'No matching files found' );
    getNewName: Function to get the new file name. The
    primary
    name is the same as the source file.
    function getNewName()
        var ext, docName, newName, saveInFile, docName;
        docName = sourceDoc.name;
        ext = '.png'; // new extension for png file
        newName = "";
        for ( var i = 0 ; docName[i] != "." ; i++ )
            newName += docName[i];
        newName += ext; // full png name of the file
        // Create a file object to save the png
        saveInFile = new File( destFolder + '/' + newName );
        return saveInFile;
    getPNGOptions: Function to set the PNG saving options of
    the
    files using the PDFSaveOptions object.
    function getPNGOptions()
        // Create the PDFSaveOptions object to set the PDF
    options
        var pngExportOpts = new ExportOptionsPNG24();
        // Setting PNGExportOptions properties. Please see
    the JavaScript Reference
        // for a description of these properties.
        // Add more properties here if you like
        pngExportOpts.antiAliasing = true;
        pngExportOpts.artBoardClipping = true;
        pngExportOpts.horizontalScale = 300.0;
        //pngExportOpts.matte = true;
        //pngExportOpts.matteColor = 0, 0, 0;
        pngExportOpts.saveAsHTML = false;
        pngExportOpts.transparency = true;
        pngExportOpts.verticalScale = 300.0;
        return pngExportOpts;

    You can turn off some of the dialogs with: app.displayDialogs = DialogModes.NO;
    #target photoshop
    if (app.documents.length > 0) {
    //Turn display dialogs off
    app.displayDialogs = DialogModes.NO;
    //=============Find Current Documents path================//
    var CurrentPath = activeDocument.path;
    //=============Establish current documents destination===============//
    var folder1 = Folder(CurrentPath + '/' + 'Flats');
    //=============Check if it exist, if not create it.============//
    if(!folder1.exists) folder1.create();
    //=============Establish current documents file name=========//
    //Current filename without the extension
    var CurrentFileName = app.activeDocument.name.replace(/\.[^\.]+$/, '');
    //=============Modify current file name================//
    var modifiedFileName = CurrentFileName +"Flat.psd";
    //=============Establish save path====================//
    var saveFileCurrentPath = new File(folder1 + '/' + modifiedFileName);
    //=============Flatten document ====================//
    activeDocument.flatten();
    //=============Rotate  document if in 'Landscape'====================//
    var myDocument = app.activeDocument;
    if (myDocument.width > myDocument.height) myDocument.rotateCanvas(90);
    //============Save File=======================//
    psdSaveOptions = new PhotoshopSaveOptions();
    activeDocument.saveAs(saveFileCurrentPath, psdSaveOptions, true, Extension.LOWERCASE);
    //Close Document
    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

  • Spot Color change to black using javascript?

    Can anyone help to convert spot color to Black using Javascript in Adobe Acrobat?

    Ok,
    try Action wizard in Acrobat and set below script to execute however you are watching a folder for PDF files.
    var doc=app.activeDocument;
    var pdfSaveOptions = new PDFSaveOptions();
    pdfSaveOptions.pDFXStandard=PDFXStandard.PDFX1A2001;
    pdfSaveOptions.compatibility = PDFCompatibility.ACROBAT4;
    pdfSaveOptions.preserveEditability = false;
    var pdfFile = new File(Folder.desktop + "/test.pdf");
    doc.saveAs(pdfFile, pdfSaveOptions);
    Hope this helps.
    as you will be applying it on a folder, Put all your PDF files in that folder and it will automatically save as you wanted.
    -Kapil Malik

  • How to batch convert Word files to pdf

    How do I batch convert Word files to pdf using Automator

    Here is a drag/drop AppleScript solution that uses the command-line LibreOffice capability to convert MS Word (.doc, .docx) files into PDF. Drag/Drop a single file, or a folder of Word documents, and it will write the respective PDF back to the original file location. When it is done, an OS X Notification will slide out onto the Desktop and provide the count of processed files.
    Save this AppleScript as a Desktop application that remains open after running. If you ignore the latter, the notification will not show when it is done. Tested on Mavericks 10.9.5.
    property name_extension : {"doc", "docx"}
    global fileCnt
    on open of finderObjects
        set fileCnt to 0
        repeat with i in (finderObjects)
        if folder of (info for i) is true then
            tell application "Finder" to set temp to (entire contents of i)
            repeat with j in (temp)
                process_files(j)
            end repeat
        else
              process_files(i)
        end if
        end repeat
        display notification "Processed Files: " & fileCnt with title "Word2PDF" subtitle "Processing Complete"
    end open
    on process_files(fname)
         set cmd to "/Applications/LibreOffice.app/Contents/MacOS/soffice "
         set cmdArgs to "--headless --convert-to pdf:writer_pdf_Export --outdir "
         tell application "Finder"
              set nameExt to name extension of fname
              set outDir to do shell script "dirname " & POSIX path of (fname as alias)
              if name extension of fname is in name_extension then
                   try
                        do shell script cmd & cmdArgs & outDir & space & POSIX path of (fname as alias)
                        set fileCnt to fileCnt + 1
                   on error errorMessage number errorNumber
                        display alert "Processing Error: " message "[ " & errorNumber & " ] " & errorMessage
                        error number -128
                   end try
              end if
         end tell
         return
    end process_files

  • How to I create an Automator workflow to batch convert Quicktime movies to

    I want to know the best way to create a Automator workflow to batch convert movies in Quicktime Pro using H.264 compression and save as a .mov file?
    Thanks in advance for reading and replying to my post,
    Sebastian

    You might find something in this database.
    Automator Actions Database

  • Converting aiff to caf for use with the logic loop browzer

    I've got a bunch of new loops. I would like to batch convert the to caf, and use them in the loop browser. Any know if this is possible????
    Thanks,
    CB

    you don't need to convert as .caf
    Logic support .aif .wav .sd2 loops and also .caf!
    No conversion is required... if they are not already apple loop compatible you need to use Apple Loop Utility to add the Logic tags
    G

  • Can I use Adobe Acrobat X Pro to batch convert v1.6 PDF files to v1.3?

    Recently I have posted up a project so the contractor can read the text in the PDF and create hyperlinks from these text. These PDFs are in format of engineering drawings.
    He informed me that he was going to use PHP to read the PDF text as javascript cannot.
    He then asked me to convert the version of our current PDF files from v1.6 to a lower version: v1.3, because php cannot work with higher PDF versions.
    So I found this PDF version converter: [link removed by forum host] but it only converts one by one. I have like a few hundreds of them, so I really need something to do batch convert.
    Could anyone help me out here? We (the small business I am working at) do not have Adobe Acrobat X Pro but will buy it if it can do the job.
    Otherwise could anyone advise me of any other software that can do this?
    Thanks heaps.

    Yes, Acrobat XI Pro can do this very easily. You can create an Action that runs the PDF Optimizer tool, which can convert the file content so it's compatible with any earlier version of PDF (as well as other things). Actions can then be run against a folder of files.

  • How do I batch convert .ai to .jpg or .png in Bridge CC 2014?

    I have found where you could "Export" them out in older versions of Bridge but no "Export" function exist in CC 2014.

    You could do it like this: http://www.santoshgs.com/blog/189/how-to-batch-convert-png-to-jpeg-using-photoshop-cs2/
    But can I be honest? I'd do that with a more efficient and far faster conversion utility like IrfanView. Photoshop is incredibly slow for this type of work. For example, I did a quick test to demonstrate the difference in performance:
    folder with 10 images in jpg format, 5600px by 5600px. Simple jpg to png batch.
    Photoshop: over six minutes.
    IrfanView: one minute and 40 seconds.
    That's a rather big difference - and with large numbers of images I just do not have the time to wait for Photoshop to finish the job. It's too slow.
    Another issue is that during the conversion process Photoshop cannot be used - while with a simple conversion utility you can leave it running in the background, and continue to use PS for other work if required. This matters if you have hundreds of images to convert.
    Btw, Irfanview (windows only) is free to download @ http://www.irfanview.com/
    The batch processing you can find under File-->Batch Conversion <b>
    ImageMagick is also free and open source. It is a command line tool, and easy to use for conversions.Will also work on a mac. But it is much slower than IrfanView, a tad faster than PS.
    http://www.imagemagick.org/script/convert.php
    http://www.ofzenandcomputing.com/batch-convert-image-formats-imagemagick/

  • How do I Batch Convert JPEG to PNG files?

    Any idea how I would convert a large number of jpeg's to png files in Photoshop CC?

    You could do it like this: http://www.santoshgs.com/blog/189/how-to-batch-convert-png-to-jpeg-using-photoshop-cs2/
    But can I be honest? I'd do that with a more efficient and far faster conversion utility like IrfanView. Photoshop is incredibly slow for this type of work. For example, I did a quick test to demonstrate the difference in performance:
    folder with 10 images in jpg format, 5600px by 5600px. Simple jpg to png batch.
    Photoshop: over six minutes.
    IrfanView: one minute and 40 seconds.
    That's a rather big difference - and with large numbers of images I just do not have the time to wait for Photoshop to finish the job. It's too slow.
    Another issue is that during the conversion process Photoshop cannot be used - while with a simple conversion utility you can leave it running in the background, and continue to use PS for other work if required. This matters if you have hundreds of images to convert.
    Btw, Irfanview (windows only) is free to download @ http://www.irfanview.com/
    The batch processing you can find under File-->Batch Conversion <b>
    ImageMagick is also free and open source. It is a command line tool, and easy to use for conversions.Will also work on a mac. But it is much slower than IrfanView, a tad faster than PS.
    http://www.imagemagick.org/script/convert.php
    http://www.ofzenandcomputing.com/batch-convert-image-formats-imagemagick/

  • How to batch convert psd to png with layers

    how to batch convert psd to png with layers
    i want to convert lots of PSD files into PNGs WHILE RETAINING
    LAYERS!
    simply batching and choosing custom setting flattens the
    thing.
    how do i do that!??
    and i KNOW it can be done somehow - because i have some old
    png's i KNOW come from the same psd source. ironic, isn't it?
    besides - feature wish for adobe developers:
    A) batch conversion should include 300dpi to 72dpi and vise
    versa.
    B) batch conversion should include PSD to PNG and vice versa
    - including layers and transparency.
    C) RGB to CMYK option when converting from 72 dpi to 300dpi.
    D) batch exporting should include PNG32 which it doesnt now -
    but somehow DOES include the outdated and stupid gif-format.
    E) i'd like the Actions feature of photoshop - makes batching
    complicated procedures easly.
    F) I'd like support for the brushes of photoshop
    G) Better selecting tools for details like hair and fine
    edges.
    Important notes is that i as webdesigner often need to make
    certain aspects of my clients graphics into print material. Also
    that i use fireworks for picture editing.
    Praise for the developers of fireworks
    A) the compression facility of JPGs is AWESOME!
    B) PNG as fileformat is likewise awesome - i end up using it
    for almost all i do these days. Transparency and good file sizes. I
    have used fireworks cs3 to convert all psd and tiff and ai files to
    PNG.
    C) the vectors and styles and method of selecting and editing
    things in fireworks is FAR SUPERIOR to flash and photoshop!

    senocular wrote:
    > Save the following code in a .jsf file and run it in a
    batch. It will save
    > your batched PSDs in their original location as PNGs
    (using the same file name
    > with .png tacked on the end). You'll probably need to
    save the file in your
    > Fireworks/Configuration/Commands directory to allow the
    batch to pick it up.
    > Note that any save location you specify in the batch
    will be irrelevant. This
    > code just saves the files in their original location.
    >
    >
    >
    > var dom = fw.getDocumentDOM();
    > fw.saveDocumentCopyAs(dom,
    dom.filePathForRevert+".png");
    >
    Thanks Trevor!
    Jim Babbage - .:Community MX:. & .:Adobe Community
    Expert:.
    http://www.communityMX.com/
    CommunityMX - Free Resources:
    http://www.communitymx.com/free.cfm
    .:Adobe Community Expert for Fireworks:.
    Adobe Community Expert
    http://tinyurl.com/2a7dyp
    See my work on Flickr
    http://www.flickr.com/photos/jim_babbage/

  • Batch convert png to jpeg with custom background

    How to batch convert pngs to jpegs, but using custom background ? Is there any action or plugin for that ?

    Image Processor in conjunction with an Action (that places and positions a background for example) should suffice.

  • Convert PS to PDF file in Adobe Distiller using javascript

    Hi scripters,
    I have created some PS files from Indesign using javascript. Files are d:\test\1.ps,2.ps
    Now I want to convert this ps files into pdf files uisng javascript?(I am not comfort to use export as PDF option for this job)
    how I can do this?
    Thanks in advance
    regards
    a r u l

    Hi arul
    Firstable, you may not need to create PS files as Indesign is able to produce PDF files natively. I was told that it was more reliable to do so using a certification profile such as PDFX.
    You will find a lot of PDF export script everywhere.
    However, if you want to go that way (PS to PDF). I did that once.
    First you determine into distiller a hotfolder where you ps files wille be generated. Then in the hotfolder options, you precise the profile you want to use. Otherwise, distiller may be using low quality PDF as default and your PDF may not be as good as you want.
    var distiller = File("c:/xxx/yyy/zzz/distiller.exe"); //the path to your distiller app.
    distiller.execute();
    Here you are !
    Loic

Maybe you are looking for