Skip to content
Related Articles

Related Articles

Python – spread()method in Wand
  • Last Updated : 08 May, 2020

Spread replaces each pixel with the random pixel value found nearby. spread() function is used to apply Spread effect to the image. The size of the area to search for a new pixel can be controlled by defining a radius.

Syntax :

wand.image.spread(radius, method)

Parameters :

Parameter Input Type Description
radius numbers.Real Distance a pixel can be displaced from source. Default value is 0.0, which will allow ImageMagick to auto select a radius.
method basestring Interpolation method. Only available with ImageMagick-7. Optional parameter.

Source Image:

Example 1:



filter_none

edit
close

play_arrow

link
brightness_4
code

# Import Image from wand.image module
from wand.image import Image
  
# Read image using Image() function
with Image(filename ="koala.jpeg") as img:
  
    # Generate spread image using spread() function
    img.spread(radius = 8.0)
    img.save(filename ="spreadkoala.jpg")

chevron_right


Output:

Example 2: Increase radius value in spread() method.

filter_none

edit
close

play_arrow

link
brightness_4
code

# Import Image from wand.image module
from wand.image import Image
  
# Read image using Image() function
with Image(filename ="koala.jpeg") as img:
  
    # Generate spread image using spread() function
    img.spread(radius = 16.0)
    img.save(filename ="spreadkoala2.jpg")

chevron_right


Output:

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :