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 :
Article Tags :