Converting Binary & Images
Computer Science: OCR GCSE, topic 1.2.30
Converting Binary and Images
All images are stored as binary. Converting between an image and its binary representation is important.

Binary to image
- In a black and white image, each pixel is represented by 1 bit:
- A 0 will represent a black area.
- A 1 will represent a white area.
- The image will be represented by a binary string.
- Use the value of each bit to colour each pixel in the right colour.
- The binary string starts at the top-left of the image and represents the first row.
- The first row is followed by the second row, and the binary string continues until the end of the image.

Image to binary
- Each pixel of the image will be represented by one bit of the binary string.
- Starting at the top left, and working across the first row:
- Write a 0 if the pixel is black.
- Write a 1 if the pixel is white.
- Continue writing a 0 or a 1 for each pixel until the end of the image.
Test yourself on Converting Binary & Images
A black and white image uses how many bits per pixel?