Wand function() function in Python (original) (raw)

Last Updated : 27 Feb, 2023

function() function is similar to evaluate function. In function() function pixel channels can be manipulated by applies a multi-argument function to pixel channels.
Following are the list of FUNCTION_TYPES in Wand:

Syntax :

wand.image.function(function, arguments, channel)

Parameters :

Parameter Input Type Description
function collections.abc.Sequence a sequence of doubles to apply against function
arguments numbers.Real Number to calculate with operator
channel basestring Optional channel to apply operation on.

Example 1:
Source Image:

Python3

from wand.image import Image

frequency = 3

phase_shift = - 90

amplitude = 0.2

bias = 0.7

with Image(filename = "koala.jpeg" ) as img:

`` img.function( 'sinusoid' , [frequency, phase_shift, amplitude, bias])

`` img.save(filename = "kl-functioned.jpeg" )

Output :

Example 2:
Source Image:

Python3

from wand.image import Image

frequency = 3

phase_shift = - 90

amplitude = 0.2

bias = 0.7

with Image(filename = "road.jpeg" ) as img:

`` img.function( 'polynomial' , [frequency, phase_shift, amplitude, bias])

`` img.save(filename = "rd-functioned.jpeg" )

Output :

Similar Reads