Batch image trace with transparent background

New Here ,
Jun 15, 2020

Copy link to clipboard

Copied

I have 1000 PNG files that need to be converted to SVG without background. The images are only 2-color silhouettes, so it's very easy to process with Image Trace preset. But the problem is that when batch processing with image trace, illustrator will not use the "ignore white" option which removes the background.

 

Is there a workaround to batch process PNG to SVG with "ignore white" enabled? I'm comfortable using javascript

 

Thanks

TOPICS
Feature request, Scripting

Views

638

Likes

Translate

Translate

Report

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

2 Correct Answers

Adobe Community Professional , Jun 16, 2020
rcraighead Adobe Community Professional , Jun 16, 2020
Yes, you can create a custom Image Trace preset, but at least in AI CC 2015 an Action will always use the default trace settings. To get around this we edited the "Tracing Presets" file so the "Default" preset produces a transparent background (Black and White only).   This file is found in various locations depending on your system and AI version. Check this thread for help finding it:How to share custom Image Trace Presets between users?   You can edit the "Vectorizing Presets" file in a text ...

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Community Professional , Jun 16, 2020
Ton Frederiks Adobe Community Professional , Jun 16, 2020
You could create a custom Image Trace preset that includes the Ignore White option. In Bridge > Tools > Illustrator > Image Trace... you can select that preset for selected images. You may need to apply a batch action to expand the tracing.  

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Community Professional ,
Jun 16, 2020

Copy link to clipboard

Copied

You could create a custom Image Trace preset that includes the Ignore White option.

In Bridge > Tools > Illustrator > Image Trace... you can select that preset for selected images.

You may need to apply a batch action to expand the tracing.

 

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Yes, you can create a custom Image Trace preset, but at least in AI CC 2015 an Action will always use the default trace settings.

To get around this we edited the "Tracing Presets" file so the "Default" preset produces a transparent background (Black and White only).

 

This file is found in various locations depending on your system and AI version. Check this thread for help finding it:
How to share custom Image Trace Presets between users?

 

You can edit the "Vectorizing Presets" file in a text editor to get the "Default" Setting you need. Alternatively you could write a script to use ANY named preset and use the script in your batch operation. This is the JavaScript we use for this purpose. You might use a portion of it for your needs:

 

function traceFPrint(PIN) {
    // Trace PNG to Vector in Illustrator
    var aDoc = app.activeDocument;
    var Selected = aDoc.selection[0]
    var Tracing_Preset = '[Default]';
    var sel = aDoc.selection;
    var f = 15; //percent of current size  
    var pItems = aDoc.pageItems;
    //Scale Fingerprint  Image
    for (var i = 0; i < pItems.length; i++) {
        pItems[i].resize(f, f, true, true, true, true, f, Transformation.DOCUMENTORIGIN);
    };
    fitArtboards(app.activeDocument);
    // Trace Fingerprint  
    for (var i = 0; i < sel.length; i++) {
        if (sel[i] == '[RasterItem ]') {
            var pic = sel[i].trace();
            pic.tracing.tracingOptions.loadFromPreset(Tracing_Preset);
            pic.tracing.expandTracing().selected = true;
        }
    }
    aDoc.layers[0].groupItems[0].name = PIN;
    zoomToSelection ();
    aDoc.activeLayer.hasSelectedArtwork = false;
}

 

 

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

There is a very simple solution to batch convert (image trace) with any settings you want, including the advanced "Ignore White" setting. If you have Illustrator 2020, here is how to do it: 

 

Open Illustrator (2020). Create a preset in Illustrator for tracing (goto "Windows > Image Trace"). I made a preset and called it "BW-No-White". The preset is set to convert to black and ignore white (= ignore white backgrounds).

 

Then open "Adobe Bridge". Within Bridge, go to the folder where you have your bitmaps that you would like to batch convert to vectors. Within Bridge, Select "Tools>Illustrator>Image Trace". Select your preset (which you set up prior in Illustrator). Set you destination folder and click OK. That's it. No need to script anything!

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

@Red_Point, How do you share these custom settings with other users? I find it rather cumbersome to share custom "Trace" settings since it requires updating an "Preference" file buried in a Preference folder that is not well document (at least in older AI CC versions).

I also find it combursome to rely on a 2nd application for a routine Illustrator function such as "Trace". 

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

I never really had to share my trace settings with anyone. Plus, sharing a preset in my case would be very easy, as it is "black" and "ignore whites". If you need to do more complex tracing, then I agree, it would be more convenient to have an "export preset" option.

 

I am also missing that in the "export for screens" dialog. I need to batch export different files sizes depending on the project I am working on. Right now, you can only set one default preset, which is very odd. Seems like the Illustrator dev team doesn't like the concept of saving presets. So I set it up to export 40 different sizes and then just delete the once I do not need. But I do always need to change the prefix naming conventions....

 

Regarding batch tracing, I am grateful that it is now possible to batch trace with any settings. That already helps me alot anyway. Saving presets (also to your own locations, locally and cloud) would be the icing on the cake.

Likes

Translate

Translate

Report

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