Jump to content
jessela

Group Curves by Image Color

Recommended Posts

I'm importing an Illustrator eps file and would like to group curves by the color in the original Illustrator file. EPS files don't pull in color data so I was wondering if it's possible to also reference a jpg image export of that Illustrator file and then pull the color from that to make curve groups.

So for example, in this image, I'm importing the Illustrator version of this but want to procedurally group all the green curves. How could I go about that?
Untitled.thumb.jpg.9a21f374be1f80d5983ea005952f948e.jpg

Share this post


Link to post
Share on other sites

You can use an expression in a group field based upon the Cd attribute. After you trace the image, follow that up with an attribute from map node to match the color to the newly traced geometry. Then promote Cd to primitives and filter from there. Another way would be to author each shape with a specific RGB color. The trace node can filer on the R, G, B, and A channels to give you only shapes of with that color.

NOTE: In this example I went ahead and "helped" out the trace node by removing the white background from the image. An RGBA PNG file is supplied to the trace with the JPG supplied to the attribute from map. This will allow trace to better find the the shapes in the picture.

ap_colors_from_trace.hiplc

Untitled-1.jpg

Edited by Atom
  • Like 1

Share this post


Link to post
Share on other sites

This seems promising, but does this work if the colors are stacked on top of each other? It seems like the example has the white and the grey removed, but if the grey outer circle is left in, does the trace and then attribute from map still pick up the different colors?

Share this post


Link to post
Share on other sites

No, so you'll have to prepare your layers correctly in Illustrator or Photoshop. A File node will read all the layers in the Illustrator file, so it's up to you to "delete" or throw away what you don't want, either in Illustrator, before export, or use a delete/blast node in Houdini after import.

COPs can read PSD files, so you might want to load your image that way, if that works better for you..?

Share this post


Link to post
Share on other sites

That's ok. I actually realized I was going about this wrong. I was thinking I wanted a tool that was an end all be all sort of thing, but this is just going to be a helper to make a longer process go faster. Since this will eventually end up in a 3d package, I can group the curves there and then run them through the Houdini Engine tool.

I did see that Labs had a PSD reader, but it seemed pretty slow.

Thanks for the help!

Share this post


Link to post
Share on other sites

Hi,

another way might be using partition sop or something similar to create equivalence classes based on a function, which can be a (vector -> int) function or whatever. Primitives are equivalent (in the same class), if the result of the function is equal.

group_curves_by_color.hipnc

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×