Skip to content

SaranDharshanSP/Image-Processing-Negative-Image-in-C

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Processing using STB Image Library

Repository Banner

This repository contains a simple C program for image processing using the STB Image library. The program loads an image, performs pixel manipulation, and saves the result as a new image.

Getting Started

Prerequisites

Installation

  1. Clone the repository:

    git clone https://github.com/SaranDharshanSP/Image-Processing-Negative-Image-in-C.git
    cd your-repo
  2. Compile the program:

    gcc -o Image-Processing-Negative-Image-in-C image_processing.c -lm

Usage

  1. Make sure you have an image named amm.jpg in the same directory as the executable.

  2. Run the compiled program:

    ./image_processing

    The program will process the image, create a new image named nan.jpg, and save it in the same directory.

Example

Input Image Output Image
Input Image 1 Output Image 1
Input Image 2 Output Image 2
Input Image 3 Output Image 3
Input Image 4 Output Image 4
Input Image 5 Output Image 5
Input Image 6 Output Image 6

Description

This program demonstrates basic image processing using the STB Image library. The following steps are performed:

  1. Load an image named amm.jpg.
  2. Determine the image's width, height, and number of color channels.
  3. Allocate memory for a new image (nimg) to store the manipulated pixels.
  4. Depending on the number of channels, invert pixel values:
    • For grayscale images (1 or 2 channels), invert pixel values.
    • For RGB images (3 channels), invert each channel's pixel value.
  5. Save the manipulated image as nan.jpg.

Contributing

Contributions are welcome! If you'd like to contribute to this project, feel free to open an issue or submit a pull request.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages