Explorar el Código

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

tags/v2.0.0
Roxie Gibson hace 5 años
padre
commit
fcd3814924
Se han modificado 1 ficheros con 7 adiciones y 0 borrados
  1. +7
    -0
      roxbot/cogs/image.py

+ 7
- 0
roxbot/cogs/image.py Ver fichero

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

Cargando…
Cancelar
Guardar