Author Topic: Comparing two pixel values  (Read 477 times)

Hi everyone! I'm having some trouble with pixel processor. What exatly i need is to compare values of two neighboring grayscale pixels. Let's call them Pixel_1 and Pixel_2 (Pixel_1 is located at the top of Pixel_2!) And i need to check if value of Pixel_1 is greater than value of Pixel_2. If it is true i want to paint pixel_2 in value of Pixel_1 and then repeat this operation for pixel_2 and pixel_3 and so on... I am trying to create a line that is going down until it meets a white pixel...

Any help will be appreciated, maybe you can tell me how to do that without pixel processor, but now i am very exсited with it and it is especially interesting for me to know how to achieve this effect usin Pixel Processor. :)
Last Edit: February 13, 2021, 05:03:36 pm

Hey, you can try this

Some explanation:
I get the position coordinates of the current pixel.
To get the position of the upper pixel, I have to get the current size of the node and use it to divide 1: this way I have the size of one pixel that I can subtract to current position Y to get the upper pixel coordinates (X does not change, and reminder: X,Y starts from top left angle). Then I make a condition comparing both values.