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):