C#Bitmap.Save transparancy不PNG保存

编程入门 行业动态 更新时间:2024-10-28 01:20:49
本文介绍了C#Bitmap.Save transparancy不PNG保存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想保存有transparancy与transparancy一个PNG文件中的Bitmap类。我有没有运气。

I'm trying to save a Bitmap class that has transparancy as a png file with transparancy. I'm having no luck.

这是我在做什么。

Bitmap ret = new Bitmap(bWidth, bHeight, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

saveing​​

ret.Save(filename, ImageFormat.Png);

我也试过节省了FILESTREAM文件,并没有什么区别。

I also tried saving the file with a filestream, and that made no difference.

在图像是一个图片框transparancy存在,但是当我救我我只是得到一个黑色的背景。

When the image is in a Picture box the transparancy exists, but when I save i I just get a black background.

我真的不希望使用任何第三方code,他们发现了一个办法做到这一点,我想也。

I really don't want to use any 3rd party code, they found a way to do it, I'd like to also.

感谢。

推荐答案

我认为一个对话框的FilterIndex 0开始......但它实际上从1开始,所以我的图像用阿尔法transparancy被保存为照片与图像和GIF不支持Alpha透明度。所以,我的问题实际上是与该对话框。

I assumed that the FilterIndex of a dialog box started at 0...but it actually starts at 1, so my images were being saved as Gifs using alpha transparancy, and gif doesn't support alpha transparency. So my problem was actually with the dialog box.

更多推荐

C#Bitmap.Save transparancy不PNG保存

本文发布于:2023-07-26 19:04:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1217913.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Save   Bitmap   PNG   transparancy

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!