Not much to say. This was really useful with an icon set we were using.
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
string directory=@"c:\temp\";
string[] files = Directory.GetFiles(directory, "*.bmp");
foreach (string path in files)
{
Bitmap bmp = new Bitmap(path);
bmp.MakeTransparent(Color.Magenta);
FileInfo fi = new FileInfo(path);
bmp.Save(directory + fi.Name.Replace(".bmp", "") + ".png", ImageFormat.Png);
bmp.Dispose();
}
}
}
}
No comments:
Post a Comment