Aug 26, 2008

Convert Bitmaps to transparent png

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);
FileInfo fi = new FileInfo(path);
bmp.Save(directory + fi.Name.Replace(".bmp", "") + ".png", ImageFormat.Png);


No comments:

Post a Comment