如果您试图直接设置图像的大小,例如 im.size = (100, 100)
,您现在将收到 AttributeError
. 这不是要删除现有的功能,而是要引发一个明确的错误以防止以后的结果。这个 resize
方法是更改图像大小的正确方法。
例外情况如下:
im.size = (100, 100)
选择子图像。DeprecationWarning
对于此操作,由于以前需要直接图像大小设置来解决平铺范围的问题。可选行 width
参数已添加到 ImageDraw.Draw.arc
, chord
, ellipse
, pieslice
和 rectangle
.
ImageDraw.Draw.line
draws a line, or lines, between points. Previously,
when multiple points are given, for a larger width
, the joints between
these lines looked unsightly. There is now an additional optional argument,
joint
, defaulting to None
. When it is set to curved
, the joints
between the lines will become rounded.
以前 ImageOps.colorize
仅支持双色映射 black
和 white
参数分别映射到0和255。现在它支持三种颜色映射,可选 mid
参数和所有三个颜色参数的位置都可以随意指定( blackpoint
, whitepoint
和 midpoint
)。例如,对于所有可选参数:
ImageOps.colorize(im, black=(32, 37, 79), white='white', mid=(59, 101, 175),
blackpoint=15, whitepoint=240, midpoint=100)
同时 ImageOps.fit
允许用户将图像裁剪到要求的纵横比和大小,新方法 ImageOps.pad
填充图像以填充所需的纵横比和大小,用提供的填充新空间 color
并通过一个 centering
争论。