Skip to content

pulkitgarg04/image-filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Filter

Build With C LICENSE

This project provides a command-line tool for applying various image filters to bitmap images. The tool supports grayscale, sepia, reflection, and blur effects.

Requirements

  • Compiler: GCC or Clang (for compiling the source code)
  • Input Images: Must be 24-bit uncompressed BMP 4.0 files
  • Libraries: Standard C libraries, including math.h (linked with -lm)

Compilation

To compile the source code, use the following command:

For gcc:

gcc -ggdb3 -gdwarf-4 -O0 -std=c11 -Wall -Werror -Wextra -Wno-gnu-folding-constant -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow -lm -o filter filter.c helpers.c

For clang:

clang -ggdb3 -gdwarf-4 -O0 -std=c11 -Wall -Werror -Wextra -Wno-gnu-folding-constant -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow -lm -o filter filter.c helpers.c

This command will generate an executable named filter.

Usage

You can apply different filters to your images using the following commands:

Grayscale: Convert an image to grayscale:

./filter -g ./images/courtyard.bmp ./images/courtyard-grayscale.bmp

Sepia: Apply a sepia tone to an image:

./filter -s ./images/stadium.bmp ./images/stadium-sepia.bmp

Reflection: Create a horizontally reflected version of an image:

./filter -r ./images/tower.bmp ./images/tower-reflected.bmp

Blur: Apply a blur effect to an image:

./filter -b ./images/yard.bmp ./images/yard-blurred.bmp

Brighten: Increase the brightness of an image:

./filter -n ./images/sky.bmp ./images/sky-brightened.bmp

Parameters

  • -g: Apply grayscale filter
  • -s: Apply sepia filter
  • -r: Apply reflection filter
  • -b: Apply blur filter
  • -n: Apply brighten filter

Image Paths

  • Place input images in the ./images/ directory or specify the correct path.
  • Ensure the output directory exists and is writable.

Notes

  • Only one filter can be applied per execution.
  • The program checks for valid BMP file formats and will exit with an error message if the input file is unsupported.
  • The brighten filter increases each RGB component by 50 (clamped to 255).

About

CLI based image filter maker made using C

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors