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.
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.
main.cpp- entry point that loads the input image and runs every filterimage.h/image.cpp- image wrapper for loading, copying, comparing, and saving JPEG filesfilters.h/filters.cpp- filter interface plus blur, grayscale, edge detection, mirror, sepia, and inversion implementationsstb_image.h- stb loader used to read JPEG filesstb_image_write.h- stb writer used to save JPEG filesMakefile- build script for the executableinput.jpg- sample source image used by the programoutput_*.jpg- generated images created when the program runs
- A C++ compiler with C++11 support
make- A Windows build environment compatible with the provided Makefile, such as MinGW or MSYS2
From the project directory, run:
makeThis builds an executable named image_processing.
Place the source image in the project root as input.jpg, then run the executable:
./image_processingOn Windows, you may need to run:
image_processing.exeWhen the program finishes, it writes these files to the project root:
output_blur.jpgoutput_black_and_white.jpgoutput_edge_detection.jpgoutput_mirror.jpgoutput_sepia.jpgoutput_invert_colors.jpg
Applies a simple separable blur using a 1D Gaussian-style kernel pass horizontally and vertically.
Converts each pixel to grayscale using luminance weighting:
Uses Sobel-style horizontal and vertical kernels to estimate edge intensity per channel.
Flips the image horizontally by swapping pixels across the vertical center line.
Applies the standard sepia color transform and clamps channel values to 255.
Subtracts each channel from 255 to produce a color-negative effect.
- The program expects
input.jpgto exist in the same directory as the executable. - Filter output images are generated files and should not be committed.
- The
cleanrule in the current Makefile uses a Windowsdelcommand, so it is intended for a Windows shell environment.
This project uses the stb libraries by Sean Barrett for JPEG loading and writing. The stb code is distributed under the MIT License.