22

无论如何,我可以在 C# 中将 png 转换为 bmp 吗?

我想下载一张图片,然后将其转换为 bmp,然后将其设置为桌面背景。

我已经完成了下载位和背景位。

我只需要将png转换为bmp。

4

3 回答 3

32
Image Dummy = Image.FromFile("image.png");
Dummy.Save("image.bmp", ImageFormat.Bmp);
于 2009-06-29T20:47:16.780 回答
10

当然。你想用你的 png 加载一个 Bitmap 对象:

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

然后保存:

myBitmap.Save("mybmp.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
于 2009-06-29T20:51:22.730 回答
1

你试过这个吗?

Image imgFile = Image.FromFile(aFileName);
imgFile .Save(strOutFileName, ImageFormat.Bmp);
于 2009-06-29T20:48:14.110 回答