Skip to content
Related Articles

Related Articles

Wand scale_rotate_translate Distortion Method Python
  • Last Updated : 11 May, 2020

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:

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up
Recommended Articles
Page :