怎样将两张jpg类型的图片混合后再导出? 通过一个软件导进了两张jpg类型的图片。两张图片混合显示。怎样将这两张混合显示的图片导出来(保存为一个文件) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你可以用Alpha混合(本例用颜色转换矩阵): static void Blend() { Bitmap bm1 = new Bitmap("Autumn Leaves.jpg"); //在示例图片文件夹中 Bitmap bm2 = new Bitmap("Oryx Antelope.jpg"); using (Graphics g = Graphics.FromImage(bm1)) { ColorMatrix colorMatrix = new ColorMatrix(); colorMatrix.Matrix33 = 0.5f; //<---- 一个总体的Alpha值 ImageAttributes imgAttributes = new ImageAttributes(); imgAttributes.SetColorMatrix(colorMatrix); g.DrawImage( bm2, new Rectangle(0, 0, bm1.Width, bm2.Height), 0.0f, 0.0f, bm2.Width, bm2.Height, GraphicsUnit.Pixel, imgAttributes); } bm1.Save(@"c:\temp\mixture.jpg"); bm1.Dispose(); bm2.Dispose(); } 就是在一张图片上在贴上另一张图片 -------------------------------------div+css 如何在一个DataGridViewLinkColumn中添加两个LinkColumn winform下面datagridview的下拉菜单加载问题。 点击两个按钮执行同样的操作 ,怎么知道点击的是哪一个? datagridview中的数据如何打印出来? 100分求DATAGRID的问题! 如何用C#重新定制NT域用户验证对话框? 初学者简单问题 由于系统缓冲区空间不足或队列已满,不能执行套接字上的操作。 关于构子 如何设置“INSERT”的模式为改写模式?请高手帮忙! 关于C#中Zlib的压缩问题 C#引用VC的ocx控件,当修改ocx控件后,C#无法找到,怎么解决?高手指点!
static void Blend()
{
Bitmap bm1 = new Bitmap("Autumn Leaves.jpg"); //在示例图片文件夹中
Bitmap bm2 = new Bitmap("Oryx Antelope.jpg"); using (Graphics g = Graphics.FromImage(bm1))
{
ColorMatrix colorMatrix = new ColorMatrix();
colorMatrix.Matrix33 = 0.5f; //<---- 一个总体的Alpha值 ImageAttributes imgAttributes = new ImageAttributes();
imgAttributes.SetColorMatrix(colorMatrix); g.DrawImage(
bm2,
new Rectangle(0, 0, bm1.Width, bm2.Height),
0.0f,
0.0f,
bm2.Width,
bm2.Height,
GraphicsUnit.Pixel,
imgAttributes);
} bm1.Save(@"c:\temp\mixture.jpg"); bm1.Dispose();
bm2.Dispose();
}
-------------------------------------
div+css