How to despeckle to remove point noise from an image in Python

Point noise is the bane of many potentially pleasing images. Let’s banish it forever with this simple setup for Python.

Let’s run this command for pip install to set up our API client.

pip install cloudmersive-image-api-client

Now we need to access the function filter_despeckle; this can be achieved with this block of code you see below.

from __future__ import print_functionimport timeimport cloudmersive_image_api_clientfrom import ApiExceptionfrom pprint import pprint# Configure API key authorization: Apikeyconfiguration = cloudmersive_image_api_client.Configuration()configuration.api_key['Apikey'] = 'YOUR_API_KEY'# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed# configuration.api_key_prefix['Apikey'] = 'Bearer'# create an instance of the API classapi_instance = cloudmersive_image_api_client.FilterApi(cloudmersive_image_api_client.ApiClient(configuration))image_file = '/path/to/file' # file | Image file to perform the operation on.  Common file formats such as PNG, JPEG are supported.try:# Despeckle to remove point noise from the imageapi_response = api_instance.filter_despeckle(image_file)pprint(api_response)except ApiException as e:print("Exception when calling FilterApi->filter_despeckle: %s\n" % e)

Easy! Now you can enter an image_file and the API will despeckle it, simple as that. This same image API has many other good functions you might like as well, for example image resizing, cropping, or even transforming a photo into a painting with a custom style!

Image for post
The ghost of point noise shall never darken your doors again!

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store