[IMP] don't reimplement randint manually
bzr revid: xmo@openerp.com-20130116143556-qlagrw7qhpuk8fuy
This commit is contained in:
parent
bffe30c15b
commit
3ee58b2a23
|
@ -26,7 +26,7 @@ except ImportError:
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
from PIL import ImageOps
|
from PIL import ImageOps
|
||||||
from random import random
|
from random import randint
|
||||||
|
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
# Image resizing
|
# Image resizing
|
||||||
|
@ -124,7 +124,7 @@ def image_colorize(original, randomize=True, color=(255, 255, 255)):
|
||||||
image = Image.new('RGB', original.size)
|
image = Image.new('RGB', original.size)
|
||||||
# generate the background color, past it as background
|
# generate the background color, past it as background
|
||||||
if randomize:
|
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(color)
|
||||||
image.paste(original, mask=original)
|
image.paste(original, mask=original)
|
||||||
# return the new image
|
# return the new image
|
||||||
|
|
Loading…
Reference in New Issue