2011-11-09 107 views
0

我正在做一个使用C#的图像处理项目,该项目需要将轮圈应用于现有的汽车image.im仍然是图像处理的初学者。到目前为止,我已经找到了使用C#的车轮圆和圆的半径的两个中心点。但我有附加在原始图像中的PNG/GIF轮图像的问题。我需要将png图像应用于轮子。任何想法如何将其归档?在jpeg图像上粘贴或合并透明支持图像

原始图像:

Original image

透明车轮图像:

Transparent wheel

目标结果:

Target result

回答

2

下面的函数将借鉴与大小指定位置的第一图像(carImage)的第二图像(wheelImage)指定

static void AppendWheel(Bitmap carImage, 
     Bitmap wheelImage, 
     float offsetLeft, 
     float offsetTop, 
     float width, 
     float height) 
    { 
     using (Graphics graphics = Graphics.FromImage(carImage)) 
     { 
      graphics.DrawImage(wheelImage, offsetLeft, offsetTop, width, height); 
     } 
    } 
+0

感谢名单,它的工作! –