Pgmagick resize() 方法 – Python
resize()函数是 Pgmagick 库中的一个内置函数,用于调整图像大小。该函数在成功时返回真值。
Syntax:
Parameters: This function accepts the string of width and height formatted as ‘widthxheight’ which depicts the dimensions of the final image.
Return Value: This function returns the Pgmagick object with image added.
输入图像:
示例 1:
resize('widthxheight')
输出:
示例 2:
# import library
from pgmagick import Image, DrawableCircle, DrawableText
from pgmagick import Geometry, Color
# draw the image of dimension 600 * 600
img = Image('input.png')
# invoke resize() function
img.resize('100x100')
# invoke write function along with filename
img.write('2_a.png')
输出:
在评论中写代码?请使用 ide.geeksforgeeks.org,生成链接并在此处分享链接。