Generate Image Noise


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  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. }

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.