简体   繁体   中英

png to bmp in C#

is there anyway that I can convert a png to a bmp in C#?

I want to download a image then convert it to a bmp then set it as the desktop background.

I have the downloading bit and the background bit done.

I just need to convert the png to a bmp.

Image Dummy = Image.FromFile("image.png");
Dummy.Save("image.bmp", ImageFormat.Bmp);

Certainly. You'd want to load up a Bitmap object with your png:

Bitmap myBitmap = new Bitmap("mypng.png");

Then save it:

myBitmap.Save("mybmp.bmp", System.Drawing.Imaging.ImageFormat.Bmp);

Have you tried this?

Image imgFile = Image.FromFile(aFileName);
imgFile .Save(strOutFileName, ImageFormat.Bmp);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM