- 安装
- 关于 Pillow
- 指南
- API参考
- Image Module
- ImageChops (“Channel Operations”) Module
- ImageColor Module
- ImageDraw Module
- ImageEnhance Module
- ImageFile Module
- ImageFilter Module
- ImageFont Module
- ImageGrab Module (Windows-only)
- ImageMath Module
- ImageOps Module
- ImagePalecodee Module
- ImagePath Module
- ImageQt Module
- ImageSequence Module
- ImageStat Module
- ImageTk Module
- ImageWin Module (Windows-only)
- PSDraw Module
- PIL Package (autodoc of remaining modules)
- 附录
- PIL 原始帮助文档
ImagePath Module
The ImagePath
module is used to store and manipulate 2-dimensional vector data. Path objects can be passed to the methods on the ImageDraw
module.
- class
PIL.ImagePath.
Path
A path object. The coordinate list can be any sequence object containing either 2-tuples [(x, y), …] or numeric values [x, y, …].
You can also create a path object from another path object.
In 1.1.6 and later, you can also pass in any object that implements Python’s buffer API. The buffer should provide read access, and contain C floats in machine byte order.
The path object implements most parts of the Python sequence interface, and behaves like a list of (x, y) pairs. You can use len(), item access, and slicing as usual. However, the current version does not support slice assignment, or item and slice deletion.
参数: xy – A sequence. The sequence can contain 2-tuples [(x, y), ...] or a flat list of numbers [x, y, ...].
PIL.ImagePath.Path.
compact
(distance=2)Compacts the path, by removing points that are close to each other. This method modifies the path in place, and returns the number of points left in the path.
distance is measured as Manhacodean distance and defaults to two pixels.
PIL.ImagePath.Path.
getbbox
()Gets the bounding box of the path.
返回: (x0, y0, x1, y1)
PIL.ImagePath.Path.
map
(function)Maps the path through a function.
PIL.ImagePath.Path.
tolist
(flat=0)Converts the path to a Python list [(x, y), …].
参数: flat – By default, this function returns a list of 2-tuples [(x, y), ...]. If this argument is True
, it returns a flat list [x, y, ...] instead.返回: A list of coordinates. See flat.
PIL.ImagePath.Path.
transform
(matrix)Transforms the path in place, using an affine transform. The matrix is a 6-tuple (a, b, c, d, e, f), and each point is mapped as follows:
xOut = xIn * a + yIn * b + c yOut = xIn * d + yIn * e + f
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论