This does the conversion for all PNG files in the current directory. It uses the convert command from ImageMagick.
for i in *.png; do
	convert ${i} \
		-alpha copy -channel alpha \
		-negate +channel -fx '#000' \
		r.png
	mv r.png ${i}
done
continuation from "Fox hole", "I wonder…", and "且如是言"
This does the conversion for all PNG files in the current directory. It uses the convert command from ImageMagick.
for i in *.png; do
	convert ${i} \
		-alpha copy -channel alpha \
		-negate +channel -fx '#000' \
		r.png
	mv r.png ${i}
done