ImageMagick is great for doing things like this from command-line if you need to write batch scripts for image processing.