简体   繁体   English

在 C# 中将 png 转换为 bmp

[英]png to bmp in C#

is there anyway that I can convert a png to a bmp in C#?无论如何,我可以在 C# 中将 png 转换为 bmp 吗?

I want to download a image then convert it to a bmp then set it as the desktop background.我想下载一个图像,然后将其转换为 bmp,然后将其设置为桌面背景。

I have the downloading bit and the background bit done.我已经完成了下载位和后台位。

I just need to convert the png to a bmp.我只需要将 png 转换为 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:你想用你的 png 加载一个 Bitmap 对象:

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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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