from PIL import Image
from PIL import ImageOps
-from random import random
+from random import randint
# ----------------------------------------
# Image resizing
image = Image.new('RGB', original.size)
# generate the background color, past it as background
if randomize:
- color = (int(random() * 192 + 32), int(random() * 192 + 32), int(random() * 192 + 32))
+ color = (randint(32, 224), randint(32, 224), randint(32, 224))
image.paste(color)
image.paste(original, mask=original)
# return the new image