Open In App

Wand scale_rotate_translate Distortion Method Python

Improve
Improve
Like Article
Like
Save
Share
Report

One more common distortion method is scale_rotate_translate. A large number of arguments are controlled by scale_rotate_translate method. Arguments controlled by scale_rotate_translate method are as follows:

  • X
  • Y
  • ScaleX
  • ScaleY
  • Angle
  • NewX
  • NewY

Syntax: BaseImage.distort(‘scale_rotate_translate’, **kwargs)

Input Image:

Example #1:




# Import Color from wand.color module
from wand.color import Color
# Import Image from wand.image module
from wand.image import Image
  
with Image(filename ='gog.png') as img:
    img.resize(140, 92)
    img.background_color = Color('skyblue')
    img.virtual_pixel = 'background'
    angle = 90.0
  
    # scale_rotate_translate method using distort function
    img.distort('scale_rotate_translate', (angle, ))
    img.save(filename ="srtgfg.png")


Output:

Example #2:




# Import Color from wand.color module
from wand.color import Color
# Import Image from wand.image module
from wand.image import Image
  
with Image(filename ='gog.png') as img:
    img.resize(140, 92)
    img.background_color = Color('skyblue')
    img.virtual_pixel = 'background'
    angle = 90.0
    scale = 0.5
  
    # scale_rotate_translate method using distort function
    img.distort('scale_rotate_translate', (scale, angle, ))
    img.save(filename ="srtgfg2.png")


Output:



Last Updated : 11 May, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads