从2个不同的图像创建新的图像C# [英] Create new Image from 2 diferent images C#
本文介绍了从2个不同的图像创建新的图像C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在一个函数中工作,我有两个图像,其中一个是背景,另一个是QR码,我需要使用背景(图像1)和QR图像创建一个新图像,但是我需要定义QRCode图像的位置。
像下图所示,
祝好运
使用(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);
}
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,
best regards
解决方案
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);
}
这篇关于从2个不同的图像创建新的图像C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文