Re: Invert Black/White Colors of Binary Images
- To: mathgroup at smc.vnet.net
- Subject: [mg84174] Re: Invert Black/White Colors of Binary Images
- From: dh <dh at metrohm.ch>
- Date: Wed, 12 Dec 2007 19:57:28 -0500 (EST)
- References: <fjnupg$fhc$1@smc.vnet.net>
Hi Tara, simpliy replace 0 by 1 and vice versa: image = image /. {1 -> 0, 0 -> 1} hope this helps, Daniel Tara.Ann.Lorenz at gmail.com wrote: > Hi, > > I am using the following code to create black and white images with > 5% black pixels and 95% white pixels: > > blackcolor = Table[1, {45}]; > whitecolor = Table[0, {855}]; > arrayvalues = Join[blackcolor, whitecolor]; > randompermutation := RandomSample[Range[1, 900]]; > image := Partition[arrayvalues[[randompermutation]], 30]; > t1 = Graphics[Raster[image]] > > How can I invert the coloring to have 5% white and 95% black?? > > Thank you, > Tara >