Change to maskgen for farmland lines.
This commit is contained in:
parent
4cb47938b3
commit
fbb7112388
20
maskgen.py
20
maskgen.py
@ -263,6 +263,26 @@ class mstr_maskgen:
|
||||
bld_shadow.save(fn)
|
||||
|
||||
|
||||
# Let's apply a trick that came to me one night :)
|
||||
# Adds random lines to farmland areas
|
||||
if (self._tag == "landuse" and self._value == "farmland") or (self._tag == "landuse" and self._value == "farmyard"):
|
||||
lines = Image.new("RGBA", (2048,2048))
|
||||
mask_pix = mask_img.load()
|
||||
pts = []
|
||||
for l in range(96, 201):
|
||||
p = ( randrange(0,2048), randrange(0,2048) )
|
||||
pts.append(p)
|
||||
imgl = ImageDraw.Draw(lines)
|
||||
imgl.line(pts, fill="#000000", width=1, joint="curve")
|
||||
lines = lines.filter(ImageFilter.GaussianBlur(radius=1))
|
||||
linepix = lines.load()
|
||||
for y in range(0, 2048):
|
||||
for x in range(0, 2048):
|
||||
lp = linepix[x,y]
|
||||
if lp[3] > 0:
|
||||
c = (0,0,0,255-lp[3])
|
||||
mask_pix[x,y] = c
|
||||
|
||||
# Inform
|
||||
mstr_msg("maskgen", "Mask built.")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user