How to stamp text & icons onto acquired images in Dynamic .NET TWAIN?

For Dynamic .NET TWAIN v6.x and lower versions only, for V7.x+ please refer to http://developer.dynamsoft.com/dnt/kb

Microsoft .NET Framework has its built-in method Graphics.DrawImage to add an image on another at the specified location.

Here is a simple sample in C#:

        private void button2_Click(object sender, EventArgs e)

        {

            short index = dynamicDotNetTwain.CurrentImageIndexInBuffer;

            System.Drawing.Image original = dynamicDotNetTwain.GetImage(index);

            System.Drawing.Image icon = System.Drawing.Image.FromFile("C:\\temp\\test.jpg");

            Graphics g = Graphics.FromImage(original);

            g.DrawImage(icon, 100, 100, 200, 200);

            g.Dispose();

            dynamicDotNetTwain.SetImage(index, original);

        }