/*----------------------------------------------------------------
// 版权所有_HDG
//
// 文件名: ItemDemo
// 文件功能描述: 替换图片中除透明外其他颜色为某种指定颜色
//----------------------------------------------------------------*/
using System;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
namespace ItemDemo
{
class Program
{
static void Main(string[] args)
{
Image img = Image.FromStream(new MemoryStream(File.ReadAllBytes(@"C:\test.png")));
Bitmap b = new Bitmap(img);
for (int i = 0; i < b.Height; i++)
{
for (int j = 0; j < b.Width; j++)
{
Color col = b.GetPixel(j, i);
if (col.A != 0)
{
b.SetPixel(j, i, ColorTranslator.FromHtml("#010203"));
}
}
}
b.Save(@"C:\test.png");
}
}
}