Saturday, December 13, 2025
HomeLanguagesWand remap() function in Python

Wand remap() function in Python

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:




# Import Image from wand.image module
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:
  
            # remap image using remap() function
            right.remap(affinity)
        left.extent(width = left.width * 2)
  
        # adding remaped image with original image
        left.composite(right, top = 0, left = right.width)
    left.save(filename ="remapk.jpeg")


Output:

Input Image:

Example 2:




# Import Image from wand.image module
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:
  
            # remap image using remap() function
            right.remap(affinity)
        left.extent(width = left.width * 2)
  
        # adding remaped image with original image
        left.composite(right, top = 0, left = right.width)
    left.save(filename ="roadr.jpeg")


Output:

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32447 POSTS0 COMMENTS
Milvus
105 POSTS0 COMMENTS
Nango Kala
6814 POSTS0 COMMENTS
Nicole Veronica
11952 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12030 POSTS0 COMMENTS
Shaida Kate Naidoo
6950 POSTS0 COMMENTS
Ted Musemwa
7201 POSTS0 COMMENTS
Thapelo Manthata
6898 POSTS0 COMMENTS
Umr Jansen
6882 POSTS0 COMMENTS