3

I am trying to generate outline from thousands of images and then cut them in half. I want to automate it. I made Illustrator action which is working really good. The only thing I am not being able to automate is to delete the vertical line (Shown in the picture) to make the path open.

Any idea how to automate it?

I am creating a rectangle to cut the shape in half so if there is a hidden Pathfinder shortcut or tool that leaves the path open after cropping that I can incorporate in the action, that will help too.

enter image description here

Thanks in advance.

13
  • To be clear, you want to have an open path?
    – Welz
    Commented Mar 26, 2019 at 12:49
  • Yes. It has to be open. Commented Mar 26, 2019 at 12:52
  • You should be able to create a script that uses the direct select tool (the white arrow) to select and delete the unwanted line.
    – 13ruce
    Commented Mar 26, 2019 at 12:52
  • @13ruce: Thanks for the suggestion. I am not a programmer and would like to avoid script if possible. Commented Mar 26, 2019 at 12:53
  • 1
    I don't think this is possible. In your sample it may be easy to target the only vertical path, but chances are for most artwork there won't be just one, single, vertical path. You may do better with a script utilizing Divide and then deleting the right side after divide.
    – Scott
    Commented Mar 26, 2019 at 15:50

3 Answers 3

2

I found a trick, if you don't care much about the path quality. Maybe someone can get a better idea from this.

  1. From the appearance panel → Clear Appearance
  2. Add a stroke linear gradient from black/50% location to white/50% location

    Gradient

  3. Rasterize it

  4. Apply Image Trace selecting Line Art as preset. Illustrator only allows to put in an action the default tracing presets. There's a script in this answer to record a different preset but I couldn't make it work. Maybe it's because the Illustrator version.
  5. Expand
  6. Simplify if necessary from menu ObjectPathSimplify

enter image description here

All these steps can be recorded in one action and automate the work process, without the need to use the Direct selection tool or any other manual adjustment.

By saving these steps as a script in the Illustrator scripts folder, you can add the script from the File menu in an action.

4
  • 2
    How is this better, easier, faster, cleaner, etc.... than merely clicking the vertical path and hitting the delete key?
    – Scott
    Commented Mar 26, 2019 at 17:45
  • 2
    Don't take my text as a "rant" :) it's not at all. I'm merely curious when I see.. vector > Raster > Trace to get back to vector. That always seems overly counter-productive to me. In my world, sacrificing the quality of the original path is never an option to save literally 1 click and 1 key tap. That's all.
    – Scott
    Commented Mar 26, 2019 at 17:55
  • @Danielillo I read Scott's question as just that - a question. I'm not sure why you got defensive and feel the need to be insulting. You guys have both made (and continue to make) excellent contributions to our site and we would all love for this to continue.
    – Welz
    Commented Mar 26, 2019 at 19:22
  • 2
    I removed the unnecessary debate in the comments. Please stay nice and assume good intentions.
    – Wrzlprmft
    Commented Mar 27, 2019 at 6:27
2

Save the script below as openpath.jsx or whatever with .jsx and automate it with your batch.

File > Scripts > Other Scripts

for (var i=0;i<app.activeDocument.pathItems.length;i++)  
  if (app.activeDocument.pathItems[i].closed==true)  
  app.activeDocument.pathItems[i].closed=false ;  

Since the boolean operation redefines the starting and closing points of a path, hopefully this will work in all cases.

EDIT

Since the shapes are irregular, following procedure can be used to achieve the desired result.

1) Change the fill to outline for the object that is supposed to be retained
2) Change the fill to white color for the second object (cutter)
3) Select both objects and use Ojbect > Expand (Expand Fill and Stroke)
4) Path Finder > Minus Front
13
  • It looks like this is just going to open closed paths. I think the OP wants the vertical line to go away entirely.
    – 13ruce
    Commented Mar 26, 2019 at 14:02
  • @Tough Guy: Hi, I tried the script. It does open the path however, since the shapes are being created by automation, there are segments that marks the start and end of a path and is not necessarily always that vertical line. Thanks for the script though. Commented Mar 26, 2019 at 17:51
  • @13ruce opening the path means deleting the line between first and last points. So the line goes away entirely. Commented Mar 28, 2019 at 6:46
  • @CrimsonCape As I mentioned earlier, the boolean operation (Minus front) redifines the start and end points of a path. If the script is automated right after the boolean operation, it will delete the vertical line that was created with boolean operation. Commented Mar 28, 2019 at 6:48
  • 1
    Hi, I got the issue. I was simplifying the path before running your script. When I simplified, it added extra anchor points in some cases in the vertical path which changes the path's beginning and ending point. When I am running right after using the Pathfinder tool, it effectively clears the vertical path. Thanks a lot. Commented Apr 7, 2019 at 7:52
0

Assuming you're making the rectangles one by one, selecting both shapes and hitting the Action and repeating this workflow on all thousands of shapes...

What I can think of: You can cut everything. Then selecting all and making alignment and deleting de undesired line easily.

See the image below:

enter image description here

2
  • Not a bad idea, but based on this case, I assume that everything is in it's own doc (or at least needs to be in it's position that it's in).
    – Welz
    Commented Mar 26, 2019 at 19:36
  • 1
    Thanks for the tip. However, all the shapes are being created from separate images and in separate file and they are of different width and height so this option really won't work. So far the best solution is what @Danielillo suggested. I am working to make a script for the Black and White line art option. Commented Mar 26, 2019 at 19:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.