Blur Images in Python

Blurring an image is a popular feature of image editing apps. Images are blurred for various reasons, such as for privacy protection, noise reduction, fading objects, etc. While processing images in Python, you may need to apply the blur effect on an image. To accomplish that, this article demonstrates how to blur an image in Python.

Python Library to Blur Images

To blur images, we will use Aspose.Imaging for Python. It is a powerful image editing library that lets you process and manipulate images effortlessly. To use the library, you can either download or install it using the following command.

> pip install aspose-imaging-python-net 

Steps to Blur an Image in Python

Using Aspose.Imaging for Python, you do not have to write complex code to apply blur effect on images. Below are the simple steps you need to perform to blur an image.

  • First, load the image file.
  • Then, apply the blur filter on the image.
  • Finally, save the blurred image to the disk.

Let’s now write the Python code to blur an image following the above-mentioned steps.

Blur an Image in Python

The following are the steps to blur an image in Python.

  • First, load the image using Image.load() method.
  • Then, cast image to RasterImage type.
  • After that, blur image using RasterImage.filter() method.
  • Finally, save blurred image using RasterImage.save() method.

The following code sample shows how to apply the blur effect on an image in Python.

Below is the original image that we used to apply the blurring effect.

Input Image to Apply Blur Effect

You can see the resultant blurred image below.

Output Blur Image in Python

Free Python Image Blurring Library

You can get a free temporary license and blur images without evaluation limitations.

Online Tool to Blur Images

Try our free web-based image editing tool to edit your images online. This image editing tool is powered by Aspose.Imaging for Python and you do not need to create an account for it.

Conclusion

In this article, you have learned how to blur images in Python. With the help of steps and code sample, you would have easily understood how to apply the blur effect on an image. For demonstration, we have shown you the input and output images. In the end, we have provided you with a free image editing tool that you can use to edit your images online.

You can explore more about the Python image processing library using documentation. Also, you can share your queries with us via our forum.

See Also