Thursday, September 4, 2025
HomeLanguagesWand scale_rotate_translate Distortion Method Python

Wand scale_rotate_translate Distortion Method Python

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:

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

Most Popular

Dominic
32264 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6629 POSTS0 COMMENTS
Nicole Veronica
11799 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11859 POSTS0 COMMENTS
Shaida Kate Naidoo
6749 POSTS0 COMMENTS
Ted Musemwa
7025 POSTS0 COMMENTS
Thapelo Manthata
6698 POSTS0 COMMENTS
Umr Jansen
6718 POSTS0 COMMENTS