B
bmjnine
Hi all,
I am converting image files of various formats to JPEG using:
System.Drawing.Image img = System.Drawing.Image.FromFile(myfilepath);
Works great except that transparent GIF's are over a black background
instead of white. What would be the simplest way to convert GIF's to an
Image object over a white background?
I have tried the following:
System.Drawing.Image img = new Bitmap(myfilepath);
Bitmap bmp = new Bitmap(img.Width, img.Height);
Graphics gfc = Graphics.FromImage(bmp);
gfc.Clear(Color.White);
gfc.DrawImage(img, 0, 0);
img = bmp;
This does work for the GIF's over white, but then sometimes when a JPEG
runs through this code, it gets resized, so I'm not convinced this is
the best route.
Thanks in advance,
Alyssa
I am converting image files of various formats to JPEG using:
System.Drawing.Image img = System.Drawing.Image.FromFile(myfilepath);
Works great except that transparent GIF's are over a black background
instead of white. What would be the simplest way to convert GIF's to an
Image object over a white background?
I have tried the following:
System.Drawing.Image img = new Bitmap(myfilepath);
Bitmap bmp = new Bitmap(img.Width, img.Height);
Graphics gfc = Graphics.FromImage(bmp);
gfc.Clear(Color.White);
gfc.DrawImage(img, 0, 0);
img = bmp;
This does work for the GIF's over white, but then sometimes when a JPEG
runs through this code, it gets resized, so I'm not convinced this is
the best route.
Thanks in advance,
Alyssa