Removes foreground stars from images of galaxies