Create a mask for both galaxies, draw a preview around one of them and use the SubstituteWithPreview script. The mask will be the source image and you'll need to create a black image the same size as your mask as the target image (just clone the mask image and use PixelMath with "0" as the RGB/K expression.)
Cheers,
Rick.