Now that I think of it, you could add "optipng -o7 ${f/.dot}.png" so all png files are optimized "on the go" here.