Micro Challenge #36 – Creating images with binary

26 June 2020 - 3 minute read

Welcome to the thirty-sixth of Altitude Foundation’s #MicroChallenges2020

Today’s challenge will show you how to use binary to create images

What’s a Micro Challenge?

These challenges are short activities to help you develop, revise or refresh your coding skills, posted every Monday, Wednesday and Friday.

Micro Challenge #36

Binary can work as a form of Boolean operator, where 1 = true and 0 = false. You can use these digits as a way of conveying information – for example creating images in a grid!

So this grid becomes this image.

Binary can also work as an information system – so instead of 0s and 1s corresponding to numbers, we can set them to correspond to other information. For example, here are some colours in binary: 

  • 00 – white
  • 01 – blue
  • 10 – green
  • 11 – red

Using two binary digits per square means that that square can hold 2 bits of information. If we were to add another digit, the square would hold 3 bits of information – and you can store up to eight colours! Every time you add a bit or digit, you double the amount of information you can store.

The Challenge:

Today’s challenge is to create three images – one using binary as a Boolean operator; one using the 2-bit colour scheme; and one using 3 or more bits. For the third challenge, you will need to assign values to your binary digits, essentially storing data on them!

Review it:

  • Can you colour in your patterns to create the intended image?

Advanced:

  • Could you use pseudocode to describe your colour assignments for the third challenge?

Win a micro:bit!

Don’t forget: If you submit your response to Challenge #32 via the Share It options below before the 30th of June (that’s on Monday!), you will be entered into a prize draw for one of 5 micro:bits.

  • The giveaway is open to any young person aged between 14 and 18 based in the UK. 

Share it

We would love to see what you have created! Please send any pictures, videos, or files of your activities to us – either via Facebook, Twitter or Instagram  using #MicroChallenges2020 or to challenges@altitudefoundation.org. If you are emailing them to us, please let us know if you are happy for us to share your stuff on our social media platforms (with credit, of course). 

Sign-up here to receive a weekly email with Micro Challenges top tips and solutions:



Leave a comment

Leave a Reply