旋轉會改變圖像的方向或將圖像旋轉到特定角度。 rotae()的程度可以為0到359。(實際上,您可以傳遞360、361或更多,但分別等於0、1或更多。)
用法:
wand.image.rotatae(degree, background, reset_coords)
參數:
參數 | 輸入類型 | 描述 |
---|---|---|
degree | numbers.Real | 旋轉的角度。 360的倍數沒有影響 |
background | wand.color.Color | 可選的背景色。默認是透明的。 |
reset_coords | bool | 可選標誌。如果設置,則旋轉後,坐標係將重定位到新圖像的左上角。默認情況下為True。 |
源圖像:
範例1:
# Import Image from wand.image module
from wand.image import Image
with Image(filename ="koala.jpeg") as img:
with img.clone() as rotated:
# rotate image using rotate() function
rotated.rotate(90)
rotated.save(filename ='transform-rotated-90.jpg')
輸出:
範例2:
# Import Image from wand.image module
from wand.image import Image
from wand.color import Color
with Image(filename ="koala.jpeg") as img:
with img.clone() as rotated:
# rotate image using rotate() function
rotated.rotate(135, background = Color('rgb(229, 221, 112)'))
rotated.save(filename ='transform-rotated-135.jpg')
輸出:
相關用法
- Python Wand rotate()用法及代碼示例
- Python Wand function()用法及代碼示例
- Python Wand gaussian_blur()用法及代碼示例
- Python Wand transform()用法及代碼示例
- Python Wand crop()用法及代碼示例
- Python Wand rotational_blur()用法及代碼示例
- Python Wand Image()用法及代碼示例
- Python Wand shade()用法及代碼示例
- Python Wand sharpen()用法及代碼示例
- Python Wand adaptive_sharpen()用法及代碼示例
- Python Wand noise()用法及代碼示例
- Python Wand blue_shift()用法及代碼示例
- Python Wand color_matrix()用法及代碼示例
- Python Wand unsharp_mask()用法及代碼示例
- Python Wand colorize()用法及代碼示例
注:本文由純淨天空篩選整理自RahulSabharwal大神的英文原創作品 Wand rotate() function in Python。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。