소스 검색

grain function fixed. deep fry command should work now all times.

tags/v2.0.0
Roxie Gibson 5 년 전
부모
커밋
b253494051
1개의 변경된 파일5개의 추가작업 그리고 6개의 파일을 삭제
  1. +5
    -6
      roxbot/cogs/image.py

+ 5
- 6
roxbot/cogs/image.py 파일 보기

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

@staticmethod
def add_grain(img, prob=0.2, opacity=30):
img_matrix = np.zeros(img.size, dtype=np.uint8)
for x in range(img.height):
for y in range(img.width):
img_matrix = np.zeros((img.height, img.width), dtype=np.uint8)
for y in range(img.height):
for x in range(img.width):
if prob < random.random():
img_matrix[x][y] = 255

noisy = Image.fromarray(img_matrix, "L").show()
img_matrix[y][x] = 255
noisy = Image.fromarray(img_matrix, "L")
noisy = noisy.convert("RGB")
mask = Image.new('RGBA', img.size, (0, 0, 0, opacity))
return Image.composite(noisy, img, mask)

Loading…
취소
저장