Posted By

vcskicks on 03/21/09


Tagged

image noise


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

umang_nine


Generate Image Noise


 / Published in: C#
 

URL: http://www.vcskicks.com/image-noise.php

  1. public Bitmap GenerateNoise(int width, int height)
  2. {
  3. Bitmap finalBmp = new Bitmap(width, height);
  4. Random r = new Random();
  5.  
  6. for (int x = 0; x < width; x++)
  7. {
  8. for (int y = 0; y < height; y++)
  9. {
  10. int num = r.Next(0, 256);
  11. finalBmp.SetPixel(x, y, Color.FromArgb(255, num, num, num));
  12. }
  13. }
  14.  
  15. return finalBmp;
  16. }

Report this snippet  

You need to login to post a comment.