Couldn't this be handled by a single call to `png()`? The parameters seem the same otherwise, and if `res` is omitted it's `NA`.