The task is completed on Python.
The original image is mask, the downsampled image by a factor of 2 is mask[::2, ::2], is it right?