Wand level() function in Python (original) (raw)
Last Updated : 10 Mar, 2023
level() function controls the black and white boundaries of an image. Similar to the gamma() method, mid-point levels can be adjusted with the gamma keyword argument. The black and white point arguments are expecting values between 0.0 & 1.0 which represent percentages.
Syntax :
wand.image.level(operator, value, channel)
Parameters :
Parameter Input Type Description black numbers.Real Black point, as a percentage of the system’s quantum range. Defaults to 0.. white numbers.Real White point, as a percentage of the system’s quantum range. Defaults to 1.0. gamma numbers.Real Optional gamma adjustment. Values > 1.0 lighten the image’s midtones while values < 1.0 darken them. channel basestring The channel type.
Example 1:
Source Image:
Python3
from
wand.image
import
Image
with Image(filename
=
"koala.jpeg"
) as img:
`` img.level(
0.2
,
0.9
, gamma
=
1.1
)
`` img.save(filename
=
"kl-level.jpeg"
)
Output :
Example 2:
Increasing black and white value to 0.5 and 0.7.
Python3
from
wand.image
import
Image
with Image(filename
=
"koala.jpeg"
) as img:
`` img.level(
0.5
,
0.7
, gamma
=
1.1
)
`` img.save(filename
=
"kl-level2.jpeg"
)
Output :
Similar Reads
- Wand line() function in Python line() is another drawing function present in wand.drawing module. As the name implies line() function is used to draw a line in the image. line() function only need two arguments that are start and end point of the line that we want to draw. Syntax : wand.drawing.line(start, end) Parameters : Param 2 min read
- Wand polyline() function in Python polyline() is another drawing function present in wand.drawing module of Wand. polyline() is similar to polygon() function the only difference is that, it will not close the stroke line b/w first and last point. Similar to polygon() it also takes a list of point tuples as an argument. Syntax : wand. 1 min read
- Wand path_move() function in Python path_move() is another function introduced in wand for paths. The main aim of path_move() function is to set new starting point for a new sub_path. Given to parameter can be relative, or absolute, by setting the relative flag. Syntax : wand.drawing.path_move(to, relative) Parameters: Parameter Input 1 min read
- Wand noise() function - Python The noise() function is an inbuilt function in the Python Wand ImageMagick library which is used to add noise to the image. Syntax: noise(noise_type, attenuate, channel) Parameters: This function accepts three parameters as mentioned above and defined below: noise_type: This parameter is used to sto 2 min read
- Wand path_line() function in Python path_line() is a function specially introduced for paths. path_line() draws a line from a destination point to the point we want the line we end to. It takes only end point as argument. Syntax : wand.drawing.path_line(to, relative) Parameters: ParameterInput TypeDescriptiontosequence or (numbers.Rea 1 min read
- Wand point() function in Python point() is another drawing function and simplest of all. point() function basically draw a point on a particular point on an image. It simply takes two x, y arguments for the point coordinate. Syntax : wand.drawing.point(x, y) Parameters: ParameterInput TypeDescriptionxnumbers.Realx coordinate of po 1 min read
- Wand polygon() function in Python polygon() function is another drawing function introduced in wand.drawing module. We can draw complex shapes using polygon() function. It takes a list of points in polygons as argument. Stroke line will automatically close between first & last point. Syntax : wand.drawing.polygon(points) Paramet 1 min read
- Wand arc() function in Python arc() is a function present in wand.drawing module. arc() function draws an arc in the image. You’ll need to define three pairs of (x, y) coordinates. First & second pair of coordinates will be the minimum bounding rectangle, and the last pair define the starting & ending degree. Syntax : wa 2 min read
- Wand flip() function in Python In this article we will learn what is flip() function. Basically this function returns a flipped image. Flip effect flips an image upside-down or creates an vertical reflection of image. No arguments are needed in this function. Syntax : wand.image.flip()Parameters : No Parameters in flip() function 1 min read
- Wand - blur() function in Python Blurring Image means making an image fuzzy or hazy. A blur image is indefinite and it is unable to see an image clearly. Blur is of many types, like - Adaptive blur, Gaussian blur, Selective Blur etc. In order to blur an image we use blur() function. blur() function takes three arguments. Example : 2 min read