title: Set BufferedImage to be a color in Java
body: <p>I need to create a rectangular <code>BufferedImage</code> with a specified background color, draw some pattern on the background and save it to file. I don't know how to create the background.</p>
  
  <p>I am using a nested loop:</p>
  
  <pre><code>BufferedImage b_img = ...
  for every row
  for every column
  setRGB(r,g,b);
  </code></pre>
  
  <p>But it's very slow when the image is large.</p>
  
  <p>How to set the color in a more efficient way? </p>