From 1694dd2d3495f86022e3051f71855bcd95238813 Mon Sep 17 00:00:00 2001 From: bobloy Date: Tue, 7 Sep 2021 12:30:43 -0400 Subject: [PATCH] Actually use the argument in convert --- conquest/regioner.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/conquest/regioner.py b/conquest/regioner.py index 435ae7c..afe2686 100644 --- a/conquest/regioner.py +++ b/conquest/regioner.py @@ -549,10 +549,16 @@ class MapMaker(ConquestMap): return points async def convert_masks(self, regions): - async for mask_path in AsyncIter(self.masks_path().iterdir()): - # Don't both checking if masks are in self.regions - img: Image.Image = Image.open(mask_path).convert(MASK_MODE) - img.save(mask_path, "PNG") + if regions: + async for region in regions: + mask_path = self.masks_path() / f"{region}.png" + img: Image.Image = Image.open(mask_path).convert(MASK_MODE) + img.save(mask_path) + else: + async for mask_path in AsyncIter(self.masks_path().iterdir()): + # Don't both checking if masks are in self.regions + img: Image.Image = Image.open(mask_path).convert(MASK_MODE) + img.save(mask_path, "PNG") return True async def prune_masks(self):