# Add some random trees
div = int(self._imgsize/200)
+ trees = Image.new("RGBA", (self._imgsize, self._imgsize))
for y in range(0, self._imgsize, div):
for x in range(0, self._imgsize, div):
if x > 0 and x < self._imgsize and y > 0 and y < self._imgsize:
shf_x = randrange(x-11, x+11)
shf_y = randrange(y-11, y+11)
if shf_x > 0 and shf_x < self._imgsize and shf_y > 0 and shf_y < self._imgsize:
- # Pick some file
- pick = str(randrange(1, 11))
- tree = Image.open(mstr_datafolder + "Textures\\building\\area\\p" + pick + ".png")
- layer_comp.alpha_composite(tree, (shf_x, shf_y))
- #layer_comp.paste(tree, (shf_x, shf_y))
+ # Pick a number of trees to place
+ numtrees = randrange(1, 5)
+ for i in range(1, numtrees):
+ # Pick some file
+ pick = str(randrange(1, 11))
+ tree = Image.open(mstr_datafolder + "Textures\\building\\area\\p" + pick + ".png")
+ trees.alpha_composite(tree, (shf_x, shf_y))
+ #layer_comp.paste(tree, (shf_x, shf_y))
+ trees.alpha_composite(layer_comp)
+ layer_comp = trees
mstr_msg("layergen", "Layer image generated")