DEV Community

Cover image for đź§µ Ever wonder how computers store stuff like an image?
Boluwatife Akingbade
Boluwatife Akingbade Subscriber

Posted on

đź§µ Ever wonder how computers store stuff like an image?

  1. It all starts with the BIT.
    A bit is short for “binary digit.”
    It’s the smallest unit of data in a computer and can be either a 0 or a 1.
    Think of it like a light switch: OFF = 0, ON = 1. đź’ˇ

  2. What happens when you group 8 bits together?
    You get a byte.
    Example:
    01000001 = 1 byte
    Bytes are the foundation of how data is stored and interpreted in computers.

  3. Bytes can represent... anything!

• A character like “A”
• A small number (e.g., 42)
• A tiny part of a photo
• A piece of audio

What it means depends on the context and how the program interprets it.

  1. Now let’s talk images.🖼️ Images are made of pixels (tiny colored dots). Each pixel's color is stored as a combination of bytes using models like RGB:

(Red, Green, Blue)

  1. RGB and Color Storage 🎨 In many systems, each RGB value is stored using 1 byte (8 bits). So 1 pixel = 3 bytes

Example:
Red = 255
Green = 0
Blue = 0

This pixel would appear pure red.

  1. Multiply that by millions of pixels…
    A 1080p image has over 2 million pixels.
    2 million pixels Ă— 3 bytes = ~6 megabytes (uncompressed)
    That’s a lot of 0s and 1s!

  2. So how does your image become data?
    Your camera or software converts visual information into pixels
    Each pixel is broken down into bytes
    Those bytes are saved as binary (0s and 1s)
    Stored in formats like JPEG, PNG, etc.

  3. Compression makes things smaller.
    Image formats like JPEG use compression to reduce file size.
    They find patterns in pixel data and store them more efficiently—less space, faster loading!

  4. Recap:

Bit = 0 or 1
Byte = 8 bits
Bytes store pixel color info
Pixels = images
Images = millions of bytes = millions of 0s and 1s
That’s how your selfie becomes data! 🤳💾

  1. Digital magic ✨ It’s wild to think every photo, emoji, and meme is just a giant sequence of 0s and 1s. All thanks to bits, bytes, and brilliant engineering.

ComputerScience #HowComputersWork #BitsAndBytes #TechExplained #STEM

Top comments (0)