c# .net Adsense ADO.NET Linq Viruses/security asp.net MVC JQuery Angular-js Node-js SEO Java C++ SQL API Networking vb.net .Net Css JavaScript Generics c#.Net entity framework HTML Website host Website Construction Guide HTTP tutorial W3C tutorial Web Services JSON Psychology Ionic framework Angular ReactJS Python Computer Android
Python

How to blur an image in python?

| | python

In this tutorial I will show you how to blur an image in python. 
To blur an Image:
You can use OpenCV LIbrary, which provides various image processing methods including blurring. 

Install the opencv-python Library:

pip install opencv-python

Example Program:

import cv2


try:
image = cv2.imread('angelina.jpg')

blurred_image = cv2.GaussianBlur(image, (15, 15), 0)

cv2.imshow('Original Image', image)
cv2.imshow('Blurred Image', blurred_image)
cv2.waitKey(0)
cv2.destroyAllWindows()

output_path = 'blurred_image.jpg'
cv2.imwrite(output_path, blurred_image)
cv2.waitKey(0)
cv2.destroyAllWindows()

except Exception as e:
print(f"An error occurred: {e}")

OUTPUT:

blur image in python

VIDEO GUIDE: