Claudio Gareca
Claudio Gareca

Reputation: 109

Create new Image from 2 diferent images C#

I am working in a function where I have two images, one of them is the backgroud and the other one is a QR code, I need create a new image using the background(image 1) and the QR image, but I need define the position of the QRCode Image. like the bellow image, enter image description here

best regards

Upvotes: 1

Views: 466

Answers (1)

Paviel Kraskoŭski
Paviel Kraskoŭski

Reputation: 1419

using (Image background = Image.FromFile("background.jpg"))
using (Image qrCode = Image.FromFile("qrCode.jpg"))
using (Graphics graphics = Graphics.FromImage(background))
{
    int x = 100;
    int y = 100;
    graphics.DrawImage(qrCode, x, y);
    background.Save("result.jpg", ImageFormat.Jpeg);
}

Upvotes: 3

Related Questions