浏览代码

added comment for grain because even i forgot what the fuck its doing.

tags/v2.0.0
Roxie Gibson 5 年前
父节点
当前提交
fcd3814924
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. +7
    -0
      roxbot/cogs/image.py

+ 7
- 0
roxbot/cogs/image.py 查看文件

@@ -148,6 +148,13 @@ class ImageEditor:

@staticmethod
def add_grain(img, prob=0.2, opacity=30):
"""
Adds salt and pepper grain to the given image.
:param img: :type PIL.Image: Image to add grain to
:param prob: :type float: Probability of a pixel being black between 0-1
:param opacity: :type int: opacity of the grain when composite with the given image between 0%-100%
:return: :type PIL.Image: Image with added grain
"""
img_matrix = np.zeros((img.height, img.width), dtype=np.uint8)
for y in range(img.height):
for x in range(img.width):

正在加载...
取消
保存