Look at the Netpbm collection. It contains over 300 tools and supports hundreds of graphics formats. You can easily experiment with the process you want to accomplish using the tools one by one, and later bind them together into a script. This is open source code, so if you want to obtain the maximum performance, you can even package together the code that interests you ina stand-alone program.
You typically work with netpbm by combining tools into a pipeline. So, you would use pamscale to scale your image, and pamcomp to combine the result with the watermark. If the watermark varies with each image, you can use pbmtext to create it.