📜  魔杖 scale_rotate_translate 扭曲方法Python

📅  最后修改于: 2022-05-13 01:55:22.328000             🧑  作者: Mango

魔杖 scale_rotate_translate 扭曲方法Python

一种更常见的失真方法是 scale_rotate_translate。大量参数由 scale_rotate_translate 方法控制。 scale_rotate_translate 方法控制的参数如下:

  • X
  • ScaleX
  • ScaleY
  • 角度
  • 新X
  • 新Y

输入图像:

示例 #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")

输出:

示例 #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")

输出: