Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Wand function() function in Python

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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: 
 

  • ‘undefined’
  • ‘arcsin’
  • ‘arctan’
  • ‘polynomial’
  • ‘sinusoid’

 

Syntax : 
 

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

Parameters : 
 

ParameterInput TypeDescription
functioncollections.abc.Sequencea sequence of doubles to apply against function
argumentsnumbers.RealNumber to calculate with operator 
 
channelbasestringOptional channel to apply operation on. 
 

Example 1:
Source Image: 
 

 

Python3




# Import Image from wand.image module
from wand.image import Image
 
frequency = 3
phase_shift = -90
amplitude = 0.2
bias = 0.7
 
# Read image using Image function
with Image(filename ="koala.jpeg") as img:
    # applying sinusoid FUNCTION_TYPE
    img.function('sinusoid', [frequency, phase_shift, amplitude, bias])
    img.save(filename ="kl-functioned.jpeg")

Output : 
 

Example 2:
Source Image: 
 

 

Python3




# Import Image from wand.image module
from wand.image import Image
 
frequency = 3
phase_shift = -90
amplitude = 0.2
bias = 0.7
 
# Read image using Image function
with Image(filename ="road.jpeg") as img:
    # applying sinusoid FUNCTION_TYPE
    img.function('polynomial', [frequency, phase_shift, amplitude, bias])
    img.save(filename ="rd-functioned.jpeg")

Output : 
 

 


My Personal Notes arrow_drop_up
Last Updated : 27 Feb, 2023
Like Article
Save Article
Similar Reads
Related Tutorials