Monday, June 15, 2026
HomeLanguagesWand matte_color property in Python

Wand matte_color property in Python

Some distortion transitions can not be calculated in the virtual-pixel space. Either being invalid, or NaN (not-a-number). You can define how such a pixel should be represented by setting the Image.matte_color property.

Syntax :

wand.image.matte_color = 'color'

Source Image:

Example 1:




from wand.color import Color
# Import Image from wand.image module
from wand.image import Image
   
# Read image using Image function
with Image(filename ="gog.png") as img:
    img.matte_color = Color('BLUE')
    img.virtual_pixel = 'tile'  
    args = (0, 0, 30, 60, 140, 0, 110, 60,
            0, 92, 2, 90, 140, 92, 138, 90)
    img.distort('perspective', args)
    img.save(filename ="rdmc.jpg")


Output :

Example 2:
changing VIRTUAL_PIXEL_METHOD to tile




from wand.color import Color
# Import Image from wand.image module
from wand.image import Image
   
# Read image using Image function
with Image(filename ="gog.png") as img:
    arguments = (0, 0, 20, 60,
                 90, 0, 70, 63,
                 0, 90, 5, 83,
                 90, 90, 85, 88)
    img.matte_color = Color('YELLOW')
    img.distort('perspective', arguments)
    img.save(filename ='mattegog.png')


Output :

Last Updated :
08 May, 2020
Like Article
Save Article

<!–

–>

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

Most Popular

Dominic
32515 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6897 POSTS0 COMMENTS
Nicole Veronica
12013 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7019 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6964 POSTS0 COMMENTS