The Wayback Machine - https://web.archive.org/web/20240910180306/https://www.geeksforgeeks.org/pgmagick-spread-method-python/
Open In App

Pgmagick spread() method – Python

Last Updated : 26 May, 2020
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

The spread() function is an inbuilt function in the Pgmagick library which is used to displace image pixels by a random amount. The function returns the true value on success.

Syntax:

spread(thresholdLevel)

Parameters: This function accept two parameters as mentioned above and described below:

Return Value: This function returns the Pgmagick object with image added.

Input Image:

Example 1:




from pgmagick import Image, DrawableCircle, DrawableText
from pgmagick import Geometry, Color
  
# draw the image of dimension 600 * 600
img = Image('input.png')
  
# invoke spread function with factor as 5
img.spread(5)
  
# invoke write function along with filename
img.write('2_a.png')


Output:

Example 2:




# import library
from pgmagick import Image, DrawableCircle, DrawableText
from pgmagick import Geometry, Color
  
# Draw image of dimension 600 * 600 having background green
im = Image(Geometry(600, 600), Color("# 32CD32"))
  
# invoke DrawableCircle() function
circle = DrawableCircle(100, 100, 300, 20)
  
# invoke draw() function
im.draw(circle)
  
# set font size to 40px
im.fontPointsize(40)
  
# invoke DrawableText() function
text = DrawableText(250, 450, "GeeksForGeeks")
  
# invoke draw() function
im.draw(text)
  
# invoke spread function with factor as 4
im.spread(4)
  
# invoke write function along with filename
im.write('1_b.png')


Output:



Similar Reads

Pgmagick equalize() method - Python
The equalize() function is an inbuilt function in the Pgmagick library which is used to perform histogram equalization to the image. Syntax: equalize() Parameters: This function does not accept any parameters.Return Value: This function returns the Pgmagick object with image added. Input Image: Example 1: C/C++ Code # import library from pgmagick i
1 min read
Pgmagick gamma() method - Python
The gamma() function is an inbuilt function in the Pgmagick library which is used to level of gamma correction. The function returns the true value on success. Syntax: gamma(red, green, blue) Parameters: This function accepts three parameters as red, green and blue which correct the gamma level of red, green and blue color respectively. Return Valu
1 min read
Pgmagick sharpen() method - Python
The sharpen() function is an inbuilt function in the Pgmagick library that is used to sharpen the image. It uses a Gaussian operator of the given radius and standard deviation (sigma). Syntax: sharpen( radius, sd ) Parameters: This function accept two parameters as mentioned above and described below: radius: This parameter stores the radius value
2 min read
Pgmagick enhance() method - Python
The enhance() function is an inbuilt function in the Pgmagick library which is used to apply a digital filter to enhance a noisy image. The function returns the true value on success. Syntax: enhance() Parameters: This function does not accept any parameters. Return Value: This function returns the Pgmagick object with image added. Input Image: Exa
1 min read
Pgmagick contrast() method - Python
The contrast() function is an inbuilt function in the Pgmagick library which is used to enhance or reduce the contrast of the image. The function returns the true value on success. Syntax: contrast(multiplier) Parameters: This function accepts a single parameter multiplier which is the factor by which the contrast of image should increase or decrea
1 min read
Pgmagick shade() method - Python
The shade() function is an inbuilt function in the Pgmagick library which is used to shade the image using a distant light source. The function returns the true value on success. Syntax: shade( azimuthal angle, elevation angle ) Parameters: This function accept two parameters as mentioned above and described below: azimuthal angle: This parameter s
2 min read
Pgmagick shear() method - Python
The shear() function is an inbuilt function in the Pgmagick library which is used to slide one edge of an image along the X or Y axis to create a parallelogram. The X-direction shear slides an edge along the X-axis, while a Y direction shear slides an edge along the Y-axis. The shear angle is used to set shear of the image. Syntax: shear(x, y) Para
2 min read
Pgmagick emboss() method - Python
The emboss() function is an inbuilt function in the Pgmagick library which is used to to emboss an image which means that each pixel of the image is replaced to give 3D effect. The function returns the true value on success. Syntax: emboss(radius) Parameters: This function accepts single parameter as mentioned above and described below: radius: Thi
2 min read
Pgmagick wave() method - Python
The wave() function is an inbuilt function in the Pgmagick library which is used to alter an image along with a sine wave. The function returns the true value on success. Syntax: wave(amplitude, wavelength) Parameters: This function accept two parameters as mentioned above and described below: amplitude: This parameter stores the value of the ampli
2 min read
Pgmagick edge() method - Python
The edge() function is an inbuilt function in the Pgmagick library which is used to apply a convolution filter to detect edges. Syntax: edge(radius) Parameters: This function accepts single parameter as mentioned above and defined below: radius: This parameter stores the aperture of detection filter. Return Value: This function returns the Pgmagick
1 min read
Pgmagick write() method - Python
The write() function is an inbuilt function in the Pgmagick library which is used to write an intermediate image. The current image is written to the specified filename and then processing continues using that image. Syntax: write(filename) Parameters: This function accepts single parameter which is mentioned above and defined below: filename: This
1 min read
Pgmagick despeckle() method - Python
The despeckle() function is an inbuilt function in the Pgmagick library that is used to reduce the speckles within an image. The function returns the true value of success. Syntax: emboss(radius) Parameters: This function does not accept any parameter. Return Value: This function returns the Pgmagick object with image added. Input Image: Example 1:
1 min read
Pgmagick solarize() method - Python
The solarize() function is an inbuilt function in the Pgmagick library that is used to negate all pixels above the threshold level. The function returns the true value on success. Syntax: solarize(thresholdLevel) Parameters: This function accepts a single parameter thresholdlevel which is used to specify the threshold level between 0 to 100.Return
1 min read
Pgmagick charcoal() method - Python
The charcoal() function is an inbuilt function in the Pgmagick library which is used to to add a charcoal filter to the image. The function returns the true value on success. Syntax: charcoal(factor) Parameters: This function accepts single parameters as mentioned above and described below: factor: This parameter stores the value of the charcoal fa
2 min read
Pgmagick implode() method - Python
The implode() function is an inbuilt function in the Pgmagick library which is used to implode image pixels about the center. The function returns the true value on success. Syntax: implode(factor) Parameters: This function accepts single parameter as mentioned above and described below: factor: This parameter is used to specify the factor by which
1 min read
Pgmagick blur() method - Python
The blur() function is an inbuilt function in the Pgmagick library which is used to to add blur filter to the image. The function returns the true value on success. Syntax: blur( radius, sigma ) Parameters: This function accept two parameters as mentioned above and described below: radius:This parameter stores the value of the blur radius. sigma: I
2 min read
Pgmagick swirl() method - Python
The swirl() function is an inbuilt function in the Pgmagick library which is used to around the center of the image. The degrees specify the tightness of the swirl. Syntax: swirl(angle) Parameters: This function accepts single parameter as mentioned above and described below: angle: This parameter stores the angle of the swirl. Return Value: This f
1 min read
Pgmagick flip() method - Python
The flip() function is an inbuilt function in the Pgmagick library which is used to create a mirror image in vertical direction. The function returns the true value on success. Syntax: flip() Parameters: This function does not accepts any parameter. Return Value: This function returns the Pgmagick object with image added. Input Image: Example 1: fr
1 min read
Pgmagick flop() method - Python
The flop() function is an inbuilt function in the Pgmagick library which is used to create a mirror image in horizontal direction. The function returns the true value on success. Syntax: flip() Parameters: This function does not accepts any parameter. Return Value: This function returns the Pgmagick object with image added. Input Image: Example 1:
1 min read
Pgmagick resize() method - Python
The resize() function is an inbuilt function in the Pgmagick library which is used to resize an image. The function returns the true value on success. Syntax: resize('widthxheight') Parameters: This function accepts the string of width and height formatted as 'widthxheight' which depicts the dimensions of the final image. Return Value: This functio
1 min read
Python - Scaling image using pgmagick
Scaling is the process of resizing an image. We deal with the dimensions of an image. Scaling down deals with making image smaller while Scaling up refers to increase the size of image. Scaling is a very important process in image manipulation because sometimes we get image size smaller than expected and sometimes it is very large. So, in order to
1 min read
Python - Edge extraction using pgmagick library
Edge Extraction is technique to highlight the edges present in an image. Edge extraction is used for data extraction used in computer vision for feature detection and feature extraction. Applications of Edge Extraction - 1. Medical Sciences 2. Fingerprint Scanning 3. Computer/Machine Vision 4. License plate Detection 5. Road Mapping 6. Text Detecti
1 min read
Python - Sharpen and blur filtering using pgmagick
Sharpening refers to increase contrast b/w light and dark regions and make image more defined and brings out image features. There are three main reasons to sharpen your image: to overcome blurring introduced by camera equipment, to draw attention to certain areas and to increase legibility. If a blurry text is present in image it becomes easy to r
1 min read
pgmagick Python- Introduction and Installation
pgmagick is a GraphicsMagick binding for Python. This module provides methods for Image Editing and Manipulation. pgmagick is written by Hideo Hattori. We can do a lot of things using this library such as : Resize, rotate, sharpen, color reduce, or add special effects to an image. Create transparent image assets. Compare two images. Create a gradie
2 min read
pgmagick - Add text in images
In this article we will see how to add text to images using pgmagick library in Python. We can do this by using annotate() function. Sometimes, we need to add text to images like for its copyright or name of the organization the image is associated with. In this article we will create an image with a green background text 'GeeksforGeeks' on it and
1 min read
pgmagick| creating color backgrounds
In this article we will learn how we can create a background with a solid color. We can use these backgrounds in our output image backgrounds. Also we will how to create transparent and backgrounds with color gradients. For eg: Here in the above image green us the background color of GeeksforGeeks logo so lets start with the code.1. Solid Backgroun
1 min read
Python - spread()method in Wand
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 b
1 min read
Wand spread() function - Python
The spread() function is an inbuilt function in the Python Wand ImageMagick library which is used to replace each pixel with the statistic results from neighboring pixel values. The width & height defines the size, or aperture, of the neighboring pixels. Syntax: spread(radius, method) Parameters: This function accepts two parameters as mentione
2 min read
Statistical Functions in Python | Set 2 ( Measure of Spread)
Statistical Functions in Python | Set 1(Averages and Measure of Central Location) Measure of spread functions of statistics are discussed in this article. 1. variance() :- This function calculates the variance i.e measure of deviation of data, more the value of variance, more the data values are spread. Sample variance is computed in this function,
2 min read
Node.js GM spread() Function
The spread() function is an inbuilt function in the GraphicsMagick library which is used to displace image pixels by a random amount. The function returns the true value on success. Syntax: spread(amount) Parameters: This function accepts a single parameter amount which is used to specify the value by which image pixels should displace. Return Valu
1 min read
Practice Tags :