Black and White to Colour Images using Python With Source Code

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.
Get Discount on Top Educational Courses
Source 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:

Output Image

Find More Projects
Typing Speed Test Game using Python Introduction: In this article, we will create a Typing Speed Test Game using Python and Tkinter. …
Inventory Management System Using Python Introduction The Inventory Management System is a Python-based project built using Tkinter, which provides a simple graphical …
Tilting Maze Game Using HTML CSS And JavaScript Introduction Hello coders, welcome to another new blog. Today in this article we’ll learn …
Tetris Game Using HTML CSS And JavaScript Introduction Hello coders, welcome to another new blog. Today in this article we’ll learn to …
Catch The Insect Game Using HTML CSS And JavaScript Introduction Hello coders, welcome to another new blog. Today in this article we …
electronics Store website using html CSS and JavaScript Introduction Hello coders, welcome to another new project. As you know our today’s project …