I'm doing
convert dead0000.bmp -alpha on -fill none -draw 'color 0,0 replace' dead0000.png
but I have a few thousand files. Is there any way to just do the whole directory at once?
A simple for
loop in Bash, macOS' default shell, would suffice:
for f in *.bmp; do convert "$f" -alpha on -fill none -draw 'color 0,0 replace' "${f%%.bmp}.png"; done
It uses string manipulation to replace the file extension for the output file. Here:
"$f"
is the original input filename"${f}"
is the same, just a different way of accessing the variable"${f%%.bmp}.png"
uses string replacement – f%%.bmp
means, delete the longest match of .bmp
from the back of $f
.have a look at this. mogrify is a powerful scripting tool for imagemagick http://www.imagemagick.org/script/mogrify.php (and *.bmp)