Made sure generated patches are not bigger than the ortho itself
This commit is contained in:
parent
5cc9819dba
commit
b07caba79d
@ -387,6 +387,11 @@ class mstr_layergen:
|
||||
pick = randrange(0, len(masks))
|
||||
patchmask = Image.open(masks[pick])
|
||||
patchmask = patchmask.rotate(randrange(0, 360), expand=True)
|
||||
|
||||
# Make sure patch is within bounds
|
||||
if patchmask.width > self._imgsize or patchmask.height > self._imgsize:
|
||||
patchmask.resize((mstr_photores, mstr_photores), Image.Resampling.BILINEAR)
|
||||
|
||||
patchpix = patchmask.load()
|
||||
# Pick from possible tags and values for the patches
|
||||
numbers = list(range(1, 16))
|
||||
|
@ -126,6 +126,11 @@ class mstr_photogen:
|
||||
pick = randrange(0, len(masks))
|
||||
patchmask = Image.open(masks[pick])
|
||||
patchmask = patchmask.rotate(randrange(0, 360), expand=True)
|
||||
|
||||
# Make sure patch is within bounds
|
||||
if patchmask.width > self._tile.width or patchmask.height > self._tile.height:
|
||||
patchmask.resize((mstr_photores, mstr_photores), Image.Resampling.BILINEAR)
|
||||
|
||||
patchpix = patchmask.load()
|
||||
|
||||
# Pick from possible tags and values for the patches
|
||||
|
Loading…
x
Reference in New Issue
Block a user