We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Read Pixel value from 0-255
Page Index Toggle Pages: 1
Read Pixel value from 0-255 (Read 437 times)
Read Pixel value from 0-255
Apr 17th, 2008, 3:45am
 
I've searched a lot of topics but I couldn´t find an answer.

I'm Using the .get() method to get a pixels value. The problem is that im using a grayscale image, but the .get() function returns me strange values.

Is there a way to get a colour´s value only betwen 0-255?
I know we can pass those values as parameters to other methods like stroke().
Re: Read Pixel value from 0-255
Reply #1 - Apr 17th, 2008, 10:20am
 
As in a greyscale image red, green and blue have the  same value you can use red(get(x,y)) to get the value. To understand how processing handle colours internally take a look at the http://processing.org/reference/color_.html
Re: Read Pixel value from 0-255
Reply #2 - Apr 17th, 2008, 3:36pm
 
Thank you, eskimoblood!
It worked perfectly.

this is a ScreenShot of my program.
...

It's in portuguese, but i think it's understandable. ^^
Page Index Toggle Pages: 1