在 C# 中将 png 转换为 bmp
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1060442/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
png to bmp in C#
提问by Shuttleu
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。
采纳答案by arbiter
Image Dummy = Image.FromFile("image.png");
Dummy.Save("image.bmp", ImageFormat.Bmp);
回答by Mike Dinescu
Have you tried this?
你试过这个吗?
Image imgFile = Image.FromFile(aFileName);
imgFile .Save(strOutFileName, ImageFormat.Bmp);
回答by dreadwail
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);