Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Creating a color picker using the sampleImage expression

  • Creating a color picker using the sampleImage expression

    Posted by Oscar Gomez on January 22, 2018 at 12:35 am

    Hey everyone, I have a question regarding an expression to link the colour of a layer to the position of a point control.

    So far this is what I’ve got:

    colorPicker = effect(“Color_01”)(“Point”);
    colors = thisComp.layer(“Color_pallet”)

    colors.sampleImage(colorPicker,radius = [.5, .5],postEffect = true, t = time)

    This works for everything in my comp so far. I’ve got a colour pallet layer with all the colours the point controllers in my layers are sampling the colours from. My issue is that whenever I bring in a psd image with an alpha and apply a fill effect to it, which then is linked to the colour pallet via the expression above, it always turns the colour to black. It seem to not take into consideration the expression at all.

    It would be awesome if someone knows how to fix this issue. Here’s a screenshot of the problem:

    Thanks for your help!

    Oscar Gomez replied 8 years, 7 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    January 22, 2018 at 1:22 am

    If all of your layers aren’t comp-sized and centered, you’ll need to translate the sample coordinates into the “colors” layer space. I’m guessing it will be something like this (I haven’t tested it though):

    colors.sampleImage(colors.fromComp(toComp(colorPicker)),radius = [.5, .5],postEffect = true, t = time)

    Dan

  • Oscar Gomez

    January 22, 2018 at 1:58 am

    Thanks for the reply Dan!

    I see what you are saying. Basically in order for this to work no problem my assets need to be precomposed and then there wouldn’t be a problem.

    I just tried the solution you posted and either I did it wrong or it didn’t work ☹

    Is there something I should be doing differently?

    Thanks again for the help!

    Oscar

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy