Highlighted

Expression to manipulate pixels in image

New Here ,
Jul 22, 2020

Copy link to clipboard

Copied

Is it possible to have an expression change pixel colors in an image. I'm looking for the kinda the inverse of sampleImage - I'd like to change a pixel color at a specific x/y coordinate at a specific time. 

The size I'm working with is only 35x35 pixels - so I could probably have a matrix of solids that I change colors of, but I'm hoping it would be cleaner and faster to manipulate a base image.

Topics

Expressions, How to, Scripting

Views

61

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Expression to manipulate pixels in image

New Here ,
Jul 22, 2020

Copy link to clipboard

Copied

Is it possible to have an expression change pixel colors in an image. I'm looking for the kinda the inverse of sampleImage - I'd like to change a pixel color at a specific x/y coordinate at a specific time. 

The size I'm working with is only 35x35 pixels - so I could probably have a matrix of solids that I change colors of, but I'm hoping it would be cleaner and faster to manipulate a base image.

Topics

Expressions, How to, Scripting

Views

62

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Most Valuable Participant ,
Jul 22, 2020

Copy link to clipboard

Copied

Long and short: No. Expressions modulate property streams, nothing more. Only effects can manipulate pixel buffers, ehich in itself could of course be an answer, meaning perhaps e.g. a basic Fill effect could be rigged to fill a bunch of pixels. It's just not clear what you actualyl want to achieve and a more detailed explanation would be required rather than a generic "Can I...?" question.

 

Mylenium

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Jul 22, 2020

Copy link to clipboard

Copied

Thanks. 

I'm developing content for a volumetric display of LEDS in a 35x35x20 configuration. One animation will be falling rain that is triggered by the pixel colors in a "trigger comp". Picture hundreds of strands of LEDs hanging from the ceiling in a grid pattern. 

Since I'm not dealing with a crazy amount of pixels, I'm going the route of having an array of shape or solid layers that I do the expressions on. I might have to look into crafting my own effect plugin, but at least for the time being I have a workflow.

 

I'm also experimenting with some particle plugins to see if I can align them in a grid (probably Trapcode Form) - but I'm not sure if I can address each particle independently. I'm probably looking at a world of slow renderings either way.

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Jul 22, 2020

Copy link to clipboard

Copied

Position is an array of up to 3 values with no real maximum value

Composition or layer size is an array of 2 values with a maximum value of 30,000

Color is an array of 4 values with a practical range of zero to 1.

 

This expression would change the fill color of a shape from red to blue as it moved from the top of a composition to the bottom and add or subtract green as it moved from left to right.

 

 

c = position[1];
t = position[0];
rbRatio = c / thisComp.height;
g = t / thisComp.width;
r = 1 - rbRatio;
b = rbRatio;
[r, g, b, 1]

 

 

color by position.gif

The hardest part would be figuring out what color you wanted at what position, this could be simplified if you used some if statements and linear methods to face from one color to another as you approach a known position. You can pull the color values directly from the color picker if you set the Info Panel to display decimal values for color.

 

You could also tie position to the angles in CC Color Offset or drive any color control that has numeric values like Change Color.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...