Highlighted

Batch Export as PNG

New Here ,
Mar 11, 2009

Copy link to clipboard

Copied

Hello, i'm having dreadful trouble exporting a batch of AIs to PNG (using illustrator CS4).

It seemed really obvious to record export>PNG>relevant setting as an action and then run that on the whole folder.

The trouble is that the action, when run as a batch (and only when run as a batch) skips the whole export step. it open the AI fine, runs through the action very quickly, and then fails to write the PNG.

what's more, i also tried this on a colleagues machine and his did exactly the same, so i'm thinking that it's me missing something obvious.

as a workaround i turned the dialogues on, but this kind of defeats the object.

any help would be very greatly appreciated.

cheers
Jez

Views

42.7K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Batch Export as PNG

New Here ,
Mar 11, 2009

Copy link to clipboard

Copied

Hello, i'm having dreadful trouble exporting a batch of AIs to PNG (using illustrator CS4).

It seemed really obvious to record export>PNG>relevant setting as an action and then run that on the whole folder.

The trouble is that the action, when run as a batch (and only when run as a batch) skips the whole export step. it open the AI fine, runs through the action very quickly, and then fails to write the PNG.

what's more, i also tried this on a colleagues machine and his did exactly the same, so i'm thinking that it's me missing something obvious.

as a workaround i turned the dialogues on, but this kind of defeats the object.

any help would be very greatly appreciated.

cheers
Jez

Views

42.7K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Participant ,
Mar 11, 2009

Copy link to clipboard

Copied

Well I do not know the status of the art but if they could be place in one document on multiple artboards then the solution is easy you d o not need to batch a simple export allows you to export all the art boards and individual png files all in one export operation.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Mar 16, 2009

Copy link to clipboard

Copied

Jez,

I'm having the same problem. It skips the export action. I was able to make it work in CS3, but the files are CS4.

Wade, thanks for your suggest. In this case that is not an option.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Most Valuable Participant ,
Mar 17, 2009

Copy link to clipboard

Copied

It's probably possible to do this with a script. If you're interested, contact me by email.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
May 08, 2009

Copy link to clipboard

Copied

Has anyone been able to figure out a solution to this. I have about 200 logos that I need to export as PNG files, and I REALLY don't want to have to do this one by one. Any advice would be MUCH appreciated.

Thanks!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 08, 2009

Copy link to clipboard

Copied

You might try this

/**********************************************************

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 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); // 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++ )
    {
        newName += docName;
    }
    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 = false;
    //pngExportOpts.horizontalScale = 100.0;
    //pngExportOpts.matte = true;
    //pngExportOpts.matteColor = 0, 0, 0;
    pngExportOpts.saveAsHTML = false;
    pngExportOpts.transparency = true;
    //pngExportOpts.verticalScale = 100.0;

    return pngExportOpts;
}

Copy into a text editor and save as a .jsx file and place in the presets>scripts folder.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
May 08, 2009

Copy link to clipboard

Copied

Thanks, Larry.

which segment of code do i need to copy?  I wasn't sure. Also, I pasted into text edit and Word....neither will let me save as a .jsx. Any suggestions?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 08, 2009

Copy link to clipboard

Copied

Copy everything except what I obviously wrote. Paste into text edit and save as a .txt file. Re-do the extension to .jsx, it just has to be a .jsx file to be recognized as a JavaScript. Read the documentation at the top to get an idea of what is supposed to happen.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
May 08, 2009

Copy link to clipboard

Copied

Ok.....i did what you said, but it's not working.....i double clicked my .jsx file and discovered ExtendScript Toolkit. I attached a screenshot of what I pasted. I'm not sure it's right.

Also, how do I execute a script on a whole folder through Illustrator?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 08, 2009

Copy link to clipboard

Copied

You don't double-click a script file. Glad you found the ExtendScript application. Did you put the .jsx file in the presets/scripts folder? Once it is there, restart AI and run the file from File>Scripts. You should get a list of the files in the scripts folder. Select the ExportDocsAsPNG24 and click once. It should ask you for a folder of files to save and a destination folder to save them to.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
May 08, 2009

Copy link to clipboard

Copied

Ok....wait. I didn't paste enough of the code, I looked at the other scripts already in there and saw what i did wrong. So....I was able to use the script to batch PNG, BUT....I need hi-res PNG files. Is there a way to modify the script to make it hi-res to use in Word, PPT, etc...I know...ew, but I have to. Thanks!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 08, 2009

Copy link to clipboard

Copied

Sorry that part of the Export process is not exposed to Scripting.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Community Beginner ,
May 22, 2009

Copy link to clipboard

Copied

This problem is annoying.  I'm having the same issue as pikwi

Let me know if you find a solution.  I'm going to continue to try and solve this problem.  I'll post if I find something.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Community Beginner ,
May 22, 2009

Copy link to clipboard

Copied

try revising the script and setting these values under

function getPNGOptions()

{

    pngExportOpts.verticalScale = 416.667;

    pngExportOpts.horizontalScale = 416.667;

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Community Beginner ,
May 22, 2009

Copy link to clipboard

Copied

works for me

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Jun 15, 2015

Copy link to clipboard

Copied

Hi, is it possible to activate only some layers before exporting?

Tks

Ivan

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Contributor ,
Aug 12, 2016

Copy link to clipboard

Copied

The script is very useful. Thank you very march.

I have the same question as some others here. How exactly to change the script to get PNGs with a certain definition?

I'd like to export my art boards to PNGs with 300ppi as I can do it with the intern export command where I can choose certain resolution

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Nov 15, 2016

Copy link to clipboard

Copied

I am also looking for a 300ppi solution. Has anybody come across one yet?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Nov 15, 2016

Copy link to clipboard

Copied

Try to create an Action that exports as 300 ppi PNG and use the Batch option from the Actions panel to automate the export.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Jan 07, 2020

Copy link to clipboard

Copied

I'm able to start the script within Illustrator, but I get the following error

"Error 1242: Illegal argument-argument 1

-File/folder expected

Line 55 Source Doc=app.open(files); //retruns the document object"

What am I doing wrong?

I'm trying to run the script through Adobe Illustrator's File>Script>Other Script

Suggestions?

Thanks

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Jan 13, 2020

Copy link to clipboard

Copied

That line should read:

sourceDoc = app.open(files[i]);

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Explorer ,
Apr 15, 2020

Copy link to clipboard

Copied

I want this script for converting into JPEG, please.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Jan 29, 2010

Copy link to clipboard

Copied

You've probably already found a work around since this post was back in March - but for future people who have just run into the same issue/bug (as *I* just did) - I've accomplished the goal of going from Illustrator EPS > PNG by creating a batch action to export to PSD as a first step - and then a second action (in photoshop) to go from PSD > PNG. 

It's an extra step, but much faster than doing each file individually.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...