Skip to content

AbirHasanArko/Image-Editor

Repository files navigation

Image Editor

This project is a small C++ image-processing program that loads a JPEG image, applies a set of basic filters, and writes each result back to disk as a new image.

It is built around a simple Image abstraction backed by the stb single-header libraries for loading and saving JPEG files.

What it does

The program reads input.jpg from the project root and produces one output image for each filter:

  • Blur
  • Black and white
  • Edge detection
  • Horizontal mirror
  • Sepia
  • Invert colors

Each filter is applied to a fresh copy of the original image so the outputs are independent.

Project structure

  • main.cpp - entry point that loads the input image and runs every filter
  • image.h / image.cpp - image wrapper for loading, copying, comparing, and saving JPEG files
  • filters.h / filters.cpp - filter interface plus blur, grayscale, edge detection, mirror, sepia, and inversion implementations
  • stb_image.h - stb loader used to read JPEG files
  • stb_image_write.h - stb writer used to save JPEG files
  • Makefile - build script for the executable
  • input.jpg - sample source image used by the program
  • output_*.jpg - generated images created when the program runs

Requirements

  • A C++ compiler with C++11 support
  • make
  • A Windows build environment compatible with the provided Makefile, such as MinGW or MSYS2

Build

From the project directory, run:

make

This builds an executable named image_processing.

Run

Place the source image in the project root as input.jpg, then run the executable:

./image_processing

On Windows, you may need to run:

image_processing.exe

When the program finishes, it writes these files to the project root:

  • output_blur.jpg
  • output_black_and_white.jpg
  • output_edge_detection.jpg
  • output_mirror.jpg
  • output_sepia.jpg
  • output_invert_colors.jpg

Filters

Blur

Applies a simple separable blur using a 1D Gaussian-style kernel pass horizontally and vertically.

Black and white

Converts each pixel to grayscale using luminance weighting:

$$ 0.299R + 0.587G + 0.114B $$

Edge detection

Uses Sobel-style horizontal and vertical kernels to estimate edge intensity per channel.

Mirror

Flips the image horizontally by swapping pixels across the vertical center line.

Sepia

Applies the standard sepia color transform and clamps channel values to 255.

Invert colors

Subtracts each channel from 255 to produce a color-negative effect.

Notes

  • The program expects input.jpg to exist in the same directory as the executable.
  • Filter output images are generated files and should not be committed.
  • The clean rule in the current Makefile uses a Windows del command, so it is intended for a Windows shell environment.

Acknowledgements

This project uses the stb libraries by Sean Barrett for JPEG loading and writing. The stb code is distributed under the MIT License.

About

A lightweight C++ image processing application that loads JPEG images and applies classic filters such as blur, grayscale, edge detection, sepia, inversion, and mirroring, using a custom image abstraction built on stb libraries.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors