At scale, how can I recolor shapes based on the image they're covering? For example, if you had a picture of a map, and you wanted to recolor a bunch of stars laid over top of it.

Example of the process

If you only had a few shapes like this, you could just do it by hand, but this quickly breaks down when you have a few thousand shapes. Is there a way to handle this operation in one go?

  • No no such functionality. API time
    – joojaa
    Oct 9, 2022 at 7:44
  • If you mean to recolour them automatically, this isn't possible in Illustrator using the standard tools. It's easy enough to do it manually though, with the eyedropper. Automation might be possible with a script.
    – Billy Kerr
    Oct 9, 2022 at 9:53
  • Please clarify what is constant/variable. Eg. Are stars always on same position and is only the underlying image changing? Feb 8, 2023 at 7:39

1 Answer 1


It is possible without programming nor 3rd party tools if the shapes are all nearly as big and they allow selecting them all without selecting anything else.

Easy selection is possible if the shapes are in an own layer or they have a common color which is not used elsewhere (=use Select > Same) or there simply exists so few other objects that one can remove them from the selection manually one by one.

The method:

Start by selecting the shapes. Move them to a new layer. Make also a layer which contains the duplicates of the shapes. Hide the originals. You need them later.

Your map is a bitmap image, I guess. Hide the original and make a duplicate. Make an unsharp version of the map by resampling to well visible pixel size and by blurring so that 2 adjacent pixels have same looking colors.

Remove the strokes of the shape duplicates and fill them with the same easy to see color. Make a copy of the layer of the single color shapes and hide it for future usage. Let's assume it's all done in the left in the next 3 image strip:

enter image description here

The map has a little too high resolution, but it does not prevent showing the idea:

In the middle the shape duplicates have all got Object > Path > Simplify to make them all convex.

In the right Object > Transform > Transform each > Scale is used to make the shape duplicates all only 1 pixel wide. You may need to apply the transformation twice. Here they are left too big to keep them well visible for the demonstration.

In the left in the next image many steps are performed:

  • the scaled shape duplicates are combined by applying Object > Compound Path > Make
  • the compound path is used as clipping mask for the low resolution map
  • the masked map is rasterized in high resolution
  • the rasterized image is traced in so many colors and by ignoring white that there's about one pixel sized shape for every forthcoming full-size colored shape.
  • the tracing is expanded and ungrouped

enter image description here

In the middle the original map is made visible. On it there are the duplicates of the full size single color shapes. On the top there are the single pixel size traced shapes with map colors.

In the right the single pixel size shapes are scaled to a little bigger size than the full size single color shapes. You must apply "Transform each" several times. The full size single color shapes are all brought to front.

In the left in the next image the full size single color shapes are all combined to a compound path and the scaled dots are all grouped. The compound path is used as a clipping mask for the group:

enter image description here

The fill colors are now there, but to get the strokes the original shapes must be made visible. That's done in the right. The fill colors of the original shapes are removed and the shapes are brought to front.

I must admit that the method is tiresome and there's no guarantee it works - especially if the shapes are not equal. In addition the blurring easily makes colors which do not exist in the map exactly. Coloring manually say 100 or 200 shapes can well be suggested as a better approach. If you have the ability to write working programs, preferably follow that route.

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.