If you're going for a command-line tool, ImageMagick and FFMPEG can both do this. Or, if you're more interested in something more GUI-based, GIMP will do this.
This page talks about how to do that with ImageMagick, this Stackoverflow question has a lot of good examples how to do this with FFMPEG, and here is a page that deals with doing so in GIMP.