Wand remap() function in Python
Last Updated :
11 May, 2020
The Remap Effect replaces all pixels with the closest matching pixel found in the affinity reference image. remap() rebuild image palette with closest color from given affinity image.
Syntax: wand.image.remap(affinity, method)
Parameters :
Parameter |
Input Type |
Description |
affinity |
BaseImage |
reference image. |
method |
basestring |
dither method. See DITHER_METHODS. Default is ‘no’ dither. |
Input Image:
Example 1:
from wand.image import Image
with Image(filename = "koala.jpeg" ) as left:
with left.clone() as right:
with Image(width = 100 , height = 1 , pseudo = "plasma:" ) as affinity:
right.remap(affinity)
left.extent(width = left.width * 2 )
left.composite(right, top = 0 , left = right.width)
left.save(filename = "remapk.jpeg" )
|
Output:
Input Image:
Example 2:
from wand.image import Image
with Image(filename = "road.jpeg" ) as left:
with left.clone() as right:
with Image(width = 100 , height = 1 , pseudo = "plasma:" ) as affinity:
right.remap(affinity)
left.extent(width = left.width * 2 )
left.composite(right, top = 0 , left = right.width)
left.save(filename = "roadr.jpeg" )
|
Output:
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...