Python script to convert images to blur

You can use the Python library called OpenCV to achieve this. Here's a simple script to convert images to blur using OpenCV:

import cv2
def convert_to_blur(image_path, blur_strength): # Read the image         image = cv2.imread(image_path) # Apply Gaussian blur.blurred_image = cv2.GaussianBlur(image, (blur_strength, blur_strength), 0# Display the original and blurred images cv2.imshow('Original Image', image) cv2.imshow('Blurred Image', blurred_image) cv2.waitKey(0) cv2.destroyAllWindows() # Path to the image image_path = 'your_image.jpg' # Blur strength (should be an odd number) blur_strength = 15 # Convert image to blur convert_to_blur(image_path, blur_strength)

Replace 'your_image.jpg' with the path to your image file. Adjust the blur_strength parameter to control the intensity of the blur.


The output of the code is:


Comments

Popular posts from this blog

Fetching Data from an API in React Native with Expo

State Management in React Native with Expo: A Beginner’s Guide

How to Set Up React Native with Expo 🚀