GitXplorerGitXplorer
J

Image-Processing-Into-Black-and-White

public
0 stars
0 forks
0 issues

Commits

List of commits on branch main.
Verified
aad145a9f4cbef89c602057e3b529f3517977759

Update README.md

JJr-Einstein committed 2 years ago
Verified
9c42689efcf71f25ed3a12469f937516bee8e5b5

Update README.md

JJr-Einstein committed 2 years ago
Verified
a1b761f70d08c01ed9e300425fd6e859d7b8c6c2

Update README.md

JJr-Einstein committed 2 years ago
Verified
3eb815805dbb105f36f4680e7f85744ac7918ee9

Update README.md

JJr-Einstein committed 2 years ago
Verified
11a2c1229db85281c2105ee5b4e82872e232c847

Update README.md

JJr-Einstein committed 2 years ago
Verified
3fed652cd55be41305402c3982bcf6a289b14dad

Added The File and Random Image to Process it.

JJr-Einstein committed 2 years ago

README

The README file for this repository.

Image Processing Into Black and White

This repository contains a Python script that uses the PIL (Python Imaging Library) and NumPy libraries to convert a colorful photo into black and white. Please note that the front end is still under development.

Preview

Untitled

Prerequisites

Make sure you have the following libraries installed in your Python environment:

  • PIL (pip install Pillow)
  • NumPy (pip install numpy)
  • Matplotlib (pip install matplotlib)

Usage

  1. Import the necessary libraries in your Python script:
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
  1. Load the image using PIL:
image = Image.open("path_to_image")
  1. Convert the PIL image object to a NumPy array:
arr = np.array(image)
  1. Display the original image:
plt.imshow(arr)
plt.show()
  1. Convert the image to grayscale:
grey = arr.mean(axis=2)
  1. Display the grayscale image:
plt.imshow(grey, cmap="gray")
plt.show()

Example

Here's an example of how to use the provided code:

from PIL import Image
import numpy as np
import matplotlib.pyplot as plt

# Load the image
image = Image.open("path_to_image")

# Convert the image to a NumPy array
arr = np.array(image)

# Display the original image
plt.imshow(arr)
plt.show()

# Convert the image to grayscale
grey = arr.mean(axis=2)

# Display the grayscale image
plt.imshow(grey, cmap="gray")
plt.show()

Note

  • Make sure to replace "path_to_image" with the actual path to your image file.

License

This project is licensed under the MIT License.

Contributions

Contributions to this project are welcome! To contribute, please follow these steps:

  1. Fork this repository.
  2. Create a new branch: git checkout -b my-feature-branch.
  3. Make your changes and commit them: git commit -m "Add new feature".
  4. Push to the branch: git push origin my-feature-branch.
  5. Submit a pull request.

If you encounter any issues or have suggestions for improvement, please submit them in the issue tracker.

Support

If you need any assistance or have any questions, feel free to contact the project maintainers at amankumar.singh2022@vitbhopal.ac.in Enjoy image processing with Python!