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.
Page Index Toggle Pages: 1
Pixels array (Read 1152 times)
Pixels array
Mar 25th, 2010, 3:06am
 
Hi everyone, first I'm french so my english is not fluent.

I'm new with processing and i would like to create, a glitch generator.  
A program to modify images (jpg), like we want.

But, to start, I have a problem, i don't know how to use the "pixels array" in order to modify this image.

I found i could use "bytes" but it seems complicated.
So my goal is to create a pixel array or grid, and be able to choose the pixels i want. And then, modify the pixels.
(I would use load image and then load pixels.)

I came here to find help so if anyone could explain me how to do
I will be gratefull.

Thanks a lot.
Re: Pixels array
Reply #1 - Mar 25th, 2010, 4:50am
 
Have you read the pixels[] page and the related ones You should take a look at the samples coming with Processing (use a search tool to find those using loadPixels) to get a feeling how it works.
Then if you are still stuck, try to explain what concept you don't get, exactly.
Re: Pixels array
Reply #2 - Mar 26th, 2010, 7:03am
 
hi, thanks for answering.

I already read "pixels" and "loadpixels",
but I just don't understand, how do we select the pixels after this.
How can I see it worked and H
how can I use the pixel array once I made it, we can say.

I would like to duplicate pixels, shift them, change their color...
thanks again.
Re: Pixels array
Reply #3 - Mar 26th, 2010, 8:28am
 
First note: a number of tasks can be done by Processing without needing to go down to pixel level. For example duplicating a bunch of pixels can be done with set()/get(), image(), etc.

You don't select pixels, you access them by their coordinates, flattened to a linear index (y * imageWidth + x).
Once you get the value of a pixel, you can use bit operations, for example, to alter them, then store the changed value back to the array.
Re: Pixels array
Reply #4 - Mar 27th, 2010, 12:37am
 
okai, thank you.
I'm gonna take a look at set()/get(). I didn't know we could do that this way.
If I still have problems , I will post a new message here.

thanks again.
Page Index Toggle Pages: 1