Convert Black & white image in Colour using python

Convert Black & white Image into Color using python

Introduction

Hello Curious Coders,

In this project we are going to convert the Blacka and White Image to Colour Image using Python. To do so in python we have a popular package named as CV2 which is most used to perform image related operations.

Code

				
					# import required package
import cv2

# Load the B&W image
img = cv2.imread('bw_image.jpg', 0)

# Apply a pseudocolor effect to the B&W image
colorized = cv2.applyColorMap(img, cv2.COLORMAP_JET)

# Save the colorized image
cv2.imwrite('colorized_image.jpg', colorized)
				
			

Code Explanation

  • First we imported the required package cv2.
  • Next, we loaded the Black and White Image using cv2.imread() function.
  • Later we colorized image using applyColorMap() function to colorize image using the COLORMAP_JET color map.
  • Finally using imwrite() function of cv2 package we stored our colorized image.

Output

Input Image:
B&W Image
Output Image
Black and White to Colour Image using Python

Find More Projects

library management system using python with source code using Python GUI Tkinter (Graphical User Interface) How to Run the code: Introduction:  Imagine …

Space Shooter Game Using Python with source code Overview: A space shooter game typically involves controlling a spaceship to navigate through space …

Hotel Management System Using Python with source code Introduction: Welcome to our blog post introducing a helpful tool for hotels: the Tkinter-based …

Student Management System Using Python Introduction: The Student Management System is a comprehensive software solution designed to streamline the process of managing …

Billing Management System using Python introduction: The Billing software using python is a simple yet effective Python application designed to facilitate the …

Medical Management System using Python with Complete Source code [By using Flask Framework] Introduction Hospital Management System The Hospital Management System is …

More Python Projects
Get Huge Discounts

All Coding Handwritten Notes

Browse Handwritten Notes