png在C#中为bmp

问题描述 投票:18回答:3

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

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

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

我只需要将png转换为bmp。

c# image png bmp
3个回答
28
投票
Image Dummy = Image.FromFile("image.png");
Dummy.Save("image.bmp", ImageFormat.Bmp);

7
投票

当然。您想使用png加载位图对象:

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

然后保存:

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

1
投票

您尝试过这个吗?

Image imgFile = Image.FromFile(aFileName);
imgFile .Save(strOutFileName, ImageFormat.Bmp);
© www.soinside.com 2019 - 2024. All rights reserved.