Wand function() function in Python

function() function is similar to evaluate function. In function() function pixel channels can be manipulated by applis 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 :

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:



filter_none

edit
close

play_arrow

link
brightness_4
code

# 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:
    # appying sinusoid FUCTION_TYPE
    img.function('sinusoid', [frequency, phase_shift, amplitude, bias])
    img.save(filename ="kl-functioned.jpeg")

chevron_right


Output :

Example 2:

Sorce Image:

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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:
    # appying sinusoid FUCTION_TYPE
    img.function('polynomial', [frequency, phase_shift, amplitude, bias])
    img.save(filename ="rd-functioned.jpeg")

chevron_right


Output :




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.