Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Random pixels from a BufferedImage...  RSS feed

 
tim charles
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What would be the most efficient way to grab a number of random pixels (RGB value) from a BufferedImage. Preferably equidistant from each other.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By "random", do you mean actually random x and y values, or just that they could be any x and y values? For the latter, check out the getRGB(int, int) method. The former could be implemented by feeding random values into the two parameters of that method, although that wouldn't address the equidistant constraint.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!