I found a script that helped me convert WMF files to PNGs by recursively going through a directory tree.
I am very pleased with the result. However, I find that some of the PNG files are still bigger than the original WMF files. So I found this great utility that will make the PNGs even smaller. It's PNGNQ.
So here is the script that I used initially. I commented out the "mogrify" part that worked successfully and I would like to add some other things to it, but am not sure about the syntax nor if it will work correctly.
Code: Select all
#!/bin/bash
IFS=$'\t\n'
EXTS=( png PNG)
for EXT in ${EXTS[@]};
do
for f in `find . -name "*.$EXT" -type f`;
do
dir=`dirname $f`
ff=`basename $f`
echo "Working ..........................."
#mogrify -format png -quality 90 "$f"
## This is the new stuff that I would like to add.
## The pngnq program has an option for overwriting the original png file, but I have yet to successfully get it to work correctly.
pngnq -v -n 256 "$f" # I'm not sure if it should be *.png instead of "$f" here.
done
done
For instance after I convert the files, how can I then use "mv" to rename them. Actually I could just leave them with the -nq8 extension
The other thing I would like to do is delete the old png after they've been converted.
Thanks everyone.