Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

generate image of certain resolution containing black and white noise

How how would i generate an image of certain resolution containing black and white noise. I want to generate a number of images with each images noise being different. Prefer if done in console of either linux or windows but coding is ok if really have to. Cheers

like image 634
dmonarch Avatar asked Mar 09 '23 12:03

dmonarch


1 Answers

Like this with ImageMagick which is installed on most Linux distros and is available for macOS and Windows:

convert -size 512x512 xc:gray +noise random -colorspace gray noise.jpg

enter image description here

Replace convert with magick if using v7+ of ImageMagick.

If you mean pure black and white without shades of grey, and maybe would like a different size and a PNG format, use:

convert -size 600x400 xc:gray +noise random -colorspace gray -threshold 50% noise.png

enter image description here

If you want a different distribution of noise (gaussian, poisson, binomial) or to attenuate the noise, have a look at my other answer here.

like image 111
Mark Setchell Avatar answered May 12 '23 21:05

Mark Setchell