Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PPM Image Viewer

PPM stands for Portable Pixmap Format and comes in two formats P6 and P3 . P6 stands for raw binary which we want since each colour would be 8 bits and total of 24 bits which perfectly matches with SDL graphics framework which I used .

This is a very lightweight, custom built image viewer written entirely in raw C. This program parses raw binary data from a P6 .ppm image file and renders the pixels to the screen using the SDL2 graphics framework as I have mentioned .

Features

  • Custom Binary Parser: Reads header data and extracts raw RGB pixel bytes directly from memory without relying on heavy external libraries.

Prerequisites

To run this project, you need the SDL2 development library installed on your system . SDL2 for showing image and might also need Pillow for converting png or jpeg images into ppm .

For macOS (using Homebrew): ( for both sdl2 and pillow )

brew install sdl2 
python3 -m venv .venv
source .venv/bin/activate
pip3 install Pillow

I have already written a conversion.py you can use it as ( for macOS )

python3 conversion.py

then you can later type

deactivate
rm -rf .venv

in your terminal after converting your png/jpeg image into ppm .

How to Build and Run

This project also includes Makefile to handle the compilation process without needing to attach headerfiles of sdl2 . ( can use it any OS now )

  1. Clone this repository to your local machine.
  2. Open your terminal in the project directory.
  3. To compile the code, simply run
make
./PPM_Image_File_Viewer

About

Custom Built PPM P6 file Image Viewer written in C using SDL graphics framework

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages