project-overview.md

## What is it?

A lightweight image viewer that parses PPM (Portable Pixmap) files byte-by-byte and renders them using SDL2. No image libraries, no shortcuts — just raw binary parsing and pixel manipulation.

## Why I built it

I wanted to understand how image formats actually work at the binary level. Most developers use libraries without knowing what's happening underneath. This project was about peeling back that abstraction.

## How it works

The PPM format is beautifully simple:

  • Header contains magic number (P6), dimensions, and max color value
  • Body is raw RGB bytes — 3 bytes per pixel
  • The viewer reads the header, creates an SDL window of that size, then plots each pixel

## Challenges

  • Handling comments in the PPM header (they can appear anywhere)
  • Proper SDL initialization and cleanup
  • Error handling for malformed files

## What I learned

  • Binary file I/O in C
  • SDL2 window and surface management
  • The importance of proper memory cleanup
  • How simple image formats are structured
links.sh
cat ./links