'how can i make mask image bigger with python numpy?

I have array that represent a mask with shape (3080, 2000) and dtype('uint8'), the following picture [mask image ][1]

my mask is not always a rectangle could be any shape, I just want to make the mask bigger, I mean to extend it a few pixels in every direction how can I achieve that. [1]: https://i.stack.imgur.com/K2zaA.png



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source