请问如何保存8位的位图? 我现在有个Bitmap是32位的ARGB,如何保存成8位的位图,8位的gif,8位的png??这3个编码器似乎都没有参数阿 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 C# public Bitmap ( int width, int height, PixelFormat format) 指定图像中每个像素的颜色数据的格式。 命名空间:System.Drawing.Imaging程序集:System.Drawing(在 system.drawing.dll 中)C# public enum PixelFormat ImageCodecInfo[] MyInfos = ImageCodecInfo.GetImageEncoders();ImageCodecInfo InfoPNG = MyInfos[0];for (int i = 0; i < MyInfos.Length; i++){ if (MyInfos[i].FormatDescription == "PNG") InfoPNG = MyInfos[i];}System.Drawing.Imaging.Encoder MyEncoder = System.Drawing.Imaging.Encoder.ColorDepth;EncoderParameters MyParams = new EncoderParameters();EncoderParameter MyParam = new EncoderParameter(MyEncoder, 8L);MyParams.Param[0] = MyParam;你的Bitmap.Save(文件名, InfoPNG, MyParams) GIF图片只需将if (MyInfos[i].FormatDescription == "PNG")中的PNG改为GIF即可 基础问题,各位亲帮俺解答下呗,纯粹给分哦。。。 SOCKET实现传输多个文件,解决方案 有谁知道商务部家电下乡客户端是用什么开发的吗?用的是什么通讯方式? 求使用程序验证费马定律 WebAsyncRefreshPanel中如何使用UltraWebGridExcelExporter 新手上路:字符串提取问题,在线等 怎么把一个文件读到stream中? 关于鼠标相对位置的问题 计算器程序的实现? 当应用程序窗口没被击活时,用快捷键使用程序里的功能,代码如何写啊? 50分 如何写一个基于Http的 用户协议 除了app.config和web.config外,如何读取另外自定义的配置文件?
public Bitmap (
int width,
int height,
PixelFormat format
)
程序集:System.Drawing(在 system.drawing.dll 中)C#
public enum PixelFormat
ImageCodecInfo InfoPNG = MyInfos[0];
for (int i = 0; i < MyInfos.Length; i++)
{
if (MyInfos[i].FormatDescription == "PNG")
InfoPNG = MyInfos[i];
}
System.Drawing.Imaging.Encoder MyEncoder = System.Drawing.Imaging.Encoder.ColorDepth;
EncoderParameters MyParams = new EncoderParameters();
EncoderParameter MyParam = new EncoderParameter(MyEncoder, 8L);
MyParams.Param[0] = MyParam;
你的Bitmap.Save(文件名, InfoPNG, MyParams)
if (MyInfos[i].FormatDescription == "PNG")
中的PNG改为GIF即可