pixels[] array help
in
Programming Questions
•
3 years ago
Hi,
I want to make a program that makes an array of every pixel from an image and then randomizes the array and reprints out the pixels. So for example you could make an abstract image from a normal .jpg....or even maybe rearrange and sort the pixels by color....go from there and do a bunch of stuff.
I'm trying to figure out exactly what the built in pixels[] array does. It says that the values of the array are of the color datatype. If i do something like println(myimage.pixels[400]); (just picking the 400th pixel at random here) I get a number that doesn't make sense to me like -9544132. If I try to assign a color variable to that pixel it doesn't work, i.e. color c = myimage.pixels[400]; Using the get(); function it works fine capturing a color. I know I'm way off base here...so what is that weird number? What can I do to get started writing this little program? I'm pretty sure I need to use the pixels[]; array...I just don't fully understand it.
Any help is much appreciated!!
I want to make a program that makes an array of every pixel from an image and then randomizes the array and reprints out the pixels. So for example you could make an abstract image from a normal .jpg....or even maybe rearrange and sort the pixels by color....go from there and do a bunch of stuff.
I'm trying to figure out exactly what the built in pixels[] array does. It says that the values of the array are of the color datatype. If i do something like println(myimage.pixels[400]); (just picking the 400th pixel at random here) I get a number that doesn't make sense to me like -9544132. If I try to assign a color variable to that pixel it doesn't work, i.e. color c = myimage.pixels[400]; Using the get(); function it works fine capturing a color. I know I'm way off base here...so what is that weird number? What can I do to get started writing this little program? I'm pretty sure I need to use the pixels[]; array...I just don't fully understand it.
Any help is much appreciated!!
1