Deviding PNG image into tow images using python

Hi NeuroStars ,

I have many PNG images that have the left and the right organ in the same image. as presented in the image below.

CN_mask398

How can I make the left organ in one image and the right organ in another image?

Are the images always oriented in a particular direction such that the left half of the image is one half of the brain and the other the other? If so, then you probably just need to load the file using something like Pillow, and then you can slice the file as a numpy array. If you need to do more complicated things like identifying connected components of the image, you may want tools like scikit-image or OpenCV.