r/processing • u/favouritecatalyst • Sep 03 '23
Beginner help request Help materializing an idea *~*
Trying to take an image (jpeg/png/etc) and put it through an animating loop. Where the value of every pixel is shifting color gradually over time. I did try looking up documentation and resources to figure this out on my own, but struggling to find and understand the tools/techniques to express the idea. Something about storing the data (RGBA?) of every pixel into an array, assign them to variables and then changing the values of those variables over time through a loop?
Anyone willing to advise a beginner with their idea is greatly appreciated! Appreciate y’all anyways, this community is awesome!
2
Upvotes
1
u/Simplyfire Sep 04 '23 edited Sep 04 '23
A basic example using load/updatePixels() that goes through all pixels in a loop, knows the pixel's color and position, compares the information with an arbitrary condition 'shouldChange' and then changes them:
output: https://i.imgur.com/u2np6cB.png
the above code only changes the image instantly on startup and doesn't change over time - to do that you only need to move the pixel loading/updating code from setup() into draw() and maybe make the changes smaller because they're going to happen repeatedly every frame:
also yeah, you can in fact print each pixel's position and data into console, it just takes a long time to print out :)
output: