2
$\begingroup$

I would like to make a bitmap that visually represents a binary sequence, something like this:

bitmap

Where for example the 1's become a black pixel and the 0's a white one. I have never done something similar on Mathematica, so I need some guidance for this. Any idea appreciated. Please note that I'm a beginner at this programming language, so keep it easy please. Thanks in advance.

$\endgroup$
3
$\begingroup$
data = RandomInteger[1, {300, 300}];

Image[data]

enter image description here

or

Graphics[Raster[data]]

enter image description here

You can also try:

ArrayPlot[data]
RandomImage[BernoulliDistribution[1/2], {300, 300}]

etc.

$\endgroup$
1
$\begingroup$
    ListDensityPlot[Table[RandomInteger[{0, 1}], {100}, {100}],
       InterpolationOrder -> 0,
       ColorFunction -> GrayLevel]

enter image description here

$\endgroup$
  • $\begingroup$ Not sure why but this one kept running for a while and then crashed my poor laptop. Thanks anyway! $\endgroup$ – Snowflake Mar 2 '15 at 23:09
  • $\begingroup$ Mine rendered in 0.5341 seconds using v. 10.0.0 on a Mac Pro. $\endgroup$ – David G. Stork Mar 2 '15 at 23:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.