This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
What is the to get RGB value of each pixel of a Buffered Image?
Right now i am getting RGb value using two for loops as shown in code below but it took too much long time to get rgb values as loop runs 479999 times for my image and it can even rise when i will use 16 bit image.
What Charles said.
Depending on the console implementation of your output, the call to print and println might be very time consuming.
You should not use that in time critical loops or methods.
You should consider Charles answer anyway. It is better than your solution.
If you're very concerned about time you may want to consider another language too, while fast java isn't really considered realtime. However, if it's fast enough and you want to test the amount of time it does take try getting the time in millis just before you start to process the image and another just after. Store them somewhere so you can use them for later analysis and then print that analysis to the console. Probably will be much faster for you.