소스 검색

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):

Loading…
취소
저장