ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

exspression pixel sampler

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Emma Nichols
exspression pixel sampler
on May 17, 2011 at 5:25:29 pm

Hi, I basicly I have a layer with 6 colour changing circles on it. I would like to be able sample the colour of each circle as it changes and then attach another effect to the rgb values?

Exactly like the pixel sampler preset really. ( The preset will not work for me, I have tried everything to make it work but keeps appearing with bad argument, can't find ect... ) So looking for a manual way of doing it?


Return to posts index

Walter Soyka
Re: exspression pixel sampler
on May 17, 2011 at 5:52:22 pm

[Emma Nichols] "I would like to be able sample the colour of each circle as it changes and then attach another effect to the rgb values? Exactly like the pixel sampler preset really. ( The preset will not work for me, I have tried everything to make it work but keeps appearing with bad argument, can't find ect... ) So looking for a manual way of doing it?"

You can do this in any expression with sampleImage() -- just look at the expression in the Sampled Color Output value for an example of how to use it.

That said, if the Sample Image Expression preset isn't working for you, there's something that you're not quite doing right, and you'll likely have the same problem with the expression.

All you need to do is add the Sample Image Expression preset to a layer. Find the color property you'd like to drive with Sample Image, then Alt-Click its stopwatch icon and pickwhip the "Sampled Color Output" property of the Sample Image effect.

If you're running into problems, a screenshot might help.

Walter Soyka
Principal & Designer at Keen Live
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
RenderBreak Blog - What I'm thinking when my workstation's thinking
Creative Cow Forum Host: Live & Stage Events


Return to posts index

Emma Nichols
Re: exspression pixel sampler
on May 17, 2011 at 8:31:02 pm

Thanks

Sorry I didn't mean the sample image preset I meant the CE pixel Sampler http://maltaannon.com/articles/after-effects/ce-pixelsampler/

sorry I am really new to expressions, tried this in the shape color fill which is linked to a point control and the color does change as I move the point control around but the colors aren't the same?

targetLayer = thisComp.layer("background");
samplePoint = targetLayer.effect("Point Control")("Point");
sampleRadius = [0.5,0.5];
sampledColor_8bpc = 255 * targetLayer.sampleImage(samplePoint, sampleRadius);


Here is a screen shot ... http://farm4.static.flickr.com/3265/5731500310_0371ebabf1_b.jpg

I am trying to make the color of the square change as the point roles over different colors ?

Thanks again .... really want to work this out have a deadline for uni :(


Return to posts index


Brian Charles
Re: exspression pixel sampler
on May 17, 2011 at 9:30:32 pm

Like this?

2358_colorshiftfolder.zip



Return to posts index

Darby Edelen
Re: exspression pixel sampler
on May 18, 2011 at 4:44:51 am

[Emma Nichols] "targetLayer = thisComp.layer("background");
samplePoint = targetLayer.effect("Point Control")("Point");
sampleRadius = [0.5,0.5];
sampledColor_8bpc = 255 * targetLayer.sampleImage(samplePoint, sampleRadius);"


You definitely don't want to multiply the result of sampleImage() by 255. Every color property is expecting inputs in the range of 0 (black) to 1 (white) regardless of what bit depth you're working in.

Multiplying the result by 255 will pretty assuredly result in white every time. For example, a returned value of [0.5, 0.5, 0.5, 1] (middle gray) from sampleImage() would be multiplied by 255 to become [128, 128, 128, 255] which is 128 times brighter than white!! This result is clipped to white (1) if you're not working in 32bpc.

Darby Edelen


Return to posts index

Emma Nichols
Re: exspression pixel sampler
on May 21, 2011 at 4:57:51 pm

Thanks!! took away the 255 and works perfectly


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]