Browse Source

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

tags/v2.0.0
Roxie Gibson 5 years ago
parent
commit
fcd3814924
1 changed files with 7 additions and 0 deletions
  1. +7
    -0
      roxbot/cogs/image.py

+ 7
- 0
roxbot/cogs/image.py View File

@@ -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…
Cancel
Save