Skip to main content
Inspiring
January 9, 2023
Answered

How can I quickly fix knock out issues with Outlined Characters?

  • January 9, 2023
  • 5 replies
  • 2497 views

Hello,

I commonly come across outlined characters that have clipping masks, and other garbage.  I have an action that breaks everything down to aid in cleaning it up. However, because the last step is Pathfinder - Exclude to knock out the center (or plugs as we call them) of letters like "A,B,D" I often run into an issue with over lapped character combos.  Is there a way I can still break things down but keep the characters intact?  This would be a whole lot easier if there were no compound pathed letters 🙂

 

 

The letters in the image are only outlined to illustrate the issue. 

 

Thank you!

 

My Current Action Steps are:

Ungroup
Release Compound Path
Release Clipping Mask

Set Color to Rich Black

Pathfinder - Outline

Set Color to "Swap fill and stroke"

Ungroup

Pathfinder - Exclude

Ungroup

 

 

This topic has been closed for replies.
Correct answer jduncan

So, I already had an Ungroup script that seems to work just fine for this. Once you have the text isolated just run the script below and it will ungroup all nested groups and clipping masks leaving only letters and paths. For your example file, the gradient fill is actually a clipped rectangle so you would just need to delete that and then only have your letters left over. You could then run an action that does whatever color changes you need.

 

One last note: All of the characters in your sample file are compound paths even if they don't need to be (e.g. "I"). This doesn't really cause an issue, I just wanted to point it out.

 

// Ungroup.jsx

var doc = app.activeDocument;
var sel = doc.selection;

if (sel.length > 0) {
  for (var i = 0; i < sel.length; i++) {
    ungroup(sel[i]);
  }
}

/**
 * Ungroup a groupItem within Adobe Illustrator. Similar to `Object > Ungroup`
 * @9397041 {*} object    An Adobe Illustrator groupItem
 * @9397041 {*} recursive Should nested groupItems also be ungrouped
 */
function ungroup(object, recursive) {
  // if a non group item is passed just return
  if (object.typename != "GroupItem") {
    return;
  }
  recursive = typeof recursive !== "undefined" ? recursive : true;
  var subObject;
  while (object.pageItems.length > 0) {
    if (object.pageItems[0].typename == "GroupItem" && !object.pageItems[0].clipped) {
      subObject = object.pageItems[0];
      subObject.move(object, ElementPlacement.PLACEBEFORE);
      if (recursive) {
        ungroup(subObject, recursive);
      }
    } else {
      object.pageItems[0].move(object, ElementPlacement.PLACEBEFORE);
    }
  }
}

 

5 replies

Inspiring
January 10, 2023

This is a more realistic Example of how I receive the art and the first couple of steps I need to follow to break down and rebuild the art layout.  I then tuned all of the type with knock-out issues Magenta (just for this post, not part of my workflow).
So maybe there is a way with a script that would do the breakdown for me without applying  the "Exclude" Pathfinder on overlapping areas that are smaller than 0.05"W x 0.05"H

jduncan
Community Expert
Community Expert
January 10, 2023

Since all letters are either simple pathItems or CompoundPathItems I think it should be pretty easy to get what you want via a script. After you isolate the letters from the stuff you don't need, you could just recursively dig into all of the sub items of the selection. If you encounter a letter (simple pathItem or a CompoundPathItem) move it before/after the selection, but if you encounter a group or clipped grouped (clipping mask) dig into it and look for any enclosed pathItems or CompoundPathItems.

jduncan
Community Expert
jduncanCommunity ExpertCorrect answer
Community Expert
January 10, 2023

So, I already had an Ungroup script that seems to work just fine for this. Once you have the text isolated just run the script below and it will ungroup all nested groups and clipping masks leaving only letters and paths. For your example file, the gradient fill is actually a clipped rectangle so you would just need to delete that and then only have your letters left over. You could then run an action that does whatever color changes you need.

 

One last note: All of the characters in your sample file are compound paths even if they don't need to be (e.g. "I"). This doesn't really cause an issue, I just wanted to point it out.

 

// Ungroup.jsx

var doc = app.activeDocument;
var sel = doc.selection;

if (sel.length > 0) {
  for (var i = 0; i < sel.length; i++) {
    ungroup(sel[i]);
  }
}

/**
 * Ungroup a groupItem within Adobe Illustrator. Similar to `Object > Ungroup`
 * @9397041 {*} object    An Adobe Illustrator groupItem
 * @9397041 {*} recursive Should nested groupItems also be ungrouped
 */
function ungroup(object, recursive) {
  // if a non group item is passed just return
  if (object.typename != "GroupItem") {
    return;
  }
  recursive = typeof recursive !== "undefined" ? recursive : true;
  var subObject;
  while (object.pageItems.length > 0) {
    if (object.pageItems[0].typename == "GroupItem" && !object.pageItems[0].clipped) {
      subObject = object.pageItems[0];
      subObject.move(object, ElementPlacement.PLACEBEFORE);
      if (recursive) {
        ungroup(subObject, recursive);
      }
    } else {
      object.pageItems[0].move(object, ElementPlacement.PLACEBEFORE);
    }
  }
}

 

tromboniator
Community Expert
Community Expert
January 10, 2023

Ignore

Inspiring
January 9, 2023

Actions are quick and easy to create but lack fine-grained control. A scripted solution may be more appropriate to your needs, being able to examine and manipulate individual objects within the document. Worth having a rummage online to see if there’s a cleanup script out there that already does what you want. Otherwise, if you don’t know how to script Illustrator yourself, someone here may be happy to create you a free/paid JavaScript if your needs are simple. You would need to provide more a detailed description of the artwork, what constitutes “garbage” vs wanted content, and some sample Before and After files for study. HTH

Scott Falkner
Community Expert
Community Expert
January 9, 2023

Try disabling the Ungroup.

Inspiring
January 9, 2023

hello @Scott Falkner ,
I ran my action with each of the 3 different Ungroup steps disabled and with all of the Ungroup steps disabled. I end up with the same result of the overlapped area being excluded.

Monika Gause
Community Expert
Community Expert
January 9, 2023

So those letters should should stay different colors? And should overlap in that place?

Inspiring
January 9, 2023

Hi @Monika Gause

Sorry I only used the separate colors to illustrate that they would be separate letters.
The end result should be letters that are all set to a fill of Rich Black.  If they are overlapping in any way, I would want them to remain "whole" and overlapping versus having the overlapped parts knocked out.

Monika Gause
Community Expert
Community Expert
January 9, 2023

I'm sorry, I still don't get it. So the letters being united is also not desired?