Skip to main content
David.Alan
Participating Frequently
October 7, 2021
Question

In illustrator, is there a way to script coloring objects from an image on a lower layer?

  • October 7, 2021
  • 1 reply
  • 622 views

Okay, so this might be a little complicated.

 

In Adobe Illustrator (currently 25.4.1) I have a project that I'm doing, where a pattern of objects is on one layer, and there's an image on a locked layer beneath it. What I've been doing by hand is selecting one of the objects, and using the eyedropper tool to select a color from the image, more or less where center of the object would be. This colors the object from whatever pixel I clicked on, and I lather, rinse, and repeat.

 

I'm wondering if there might be a way to script this, so that I can select all the objects on the pattern layer, and have them all select the color from the pixel in the image that would be closest to the center of the object. Even if the script did the process object by object, that'd be fine because I don't mind telling the script to get to work while I go do something else until it's finished.

 

I've tried recording the actions, but using the eyedropper to pick a color doesn't record anything to the action palette, and I wasn't sure how to script finding the center point of an object anyway.

 

Any help would be greatly appreciated. This is for a project where I need to do a couple of these designs every day, and it will probably become an annual thing.

 

Thank you all.

This topic has been closed for replies.

1 reply

CarlosCanto
Community Expert
Community Expert
October 8, 2021

are you trying to write your own script?

 

finding the center of regular shapes is relatively easy, search for "centroid" to find a javascript function online.

 

finding the center of irregular shapes it's complicated, but not impossible. Getting the color from underneath raster item could be complicated as well.

 

if you're trying do generate low poly art this might interest you, it's cheap

https://the-animated-effects.com/plugins/lowpoly-generator-photoshop-plugin/

 

 

femkeblanco
Legend
October 8, 2021

I think neither a pixel nor the color of a pixel will be accessable through a script. 

CarlosCanto
Community Expert
Community Expert
October 8, 2021

correct, but if we trace the raster image first, then it's available.