如何在使用windows gdi +生成png期间更改zip级别(从0x785E到0x78DA) [英] How to change the zip level (from 0x785E to 0x78DA)during generating a png using windows gdi+

查看:466
本文介绍了如何在使用windows gdi +生成png期间更改zip级别(从0x785E到0x78DA)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我  拍摄快照并将其保存为PNG文件,如下代码所示。

Currently I take a snapshot and save it as PNG file as following code.

结果png文件IDAT块是0x785e压缩级别,这意味着压缩级别更低。 

Zip算法级别标志:

压缩极端:78DA 

压缩标准:789C 

压缩faible: 785E

那么这些方法是否可以使用GDI +将此拉链级别更改为78DA? 

So Is these some ways to change this zip level to 78DA using GDI+? 

如果没有,是否有一些实用程序库执行此操作,谢谢! 

If not, is there some utility lib to do this, thanks! 

                Bitmap *bit;
                .......
                .......
                .......
                ULONG           quality = 10L;
		ULONG		depth = 8L;
		ULONG		render = Gdiplus::EncoderValueRenderNonProgressive;

		GetEncoderClsid0(L"image/png", &pngClsid);

		encoderParameters->Count = 3;
		encoderParameters->Parameter[0].Guid = EncoderQuality;
		encoderParameters->Parameter[0].Type = EncoderParameterValueTypeLong;
		encoderParameters->Parameter[0].NumberOfValues = 1;
		encoderParameters->Parameter[0].Value = &quality;

		encoderParameters->Parameter[1].Guid = EncoderColorDepth;
		encoderParameters->Parameter[1].Type = EncoderParameterValueTypeLong;
		encoderParameters->Parameter[1].NumberOfValues = 1;
		encoderParameters->Parameter[1].Value = &depth;
		 
		encoderParameters->Parameter[2].Guid = EncoderRenderMethod;
		encoderParameters->Parameter[2].Type = EncoderParameterValueTypeLong;
		encoderParameters->Parameter[2].NumberOfValues = 1;
		encoderParameters->Parameter[2].Value = &render;

                bit->Save(szFileName.c_str(), &pngClsid, encoderParameters)

推荐答案

嗨Andyzn,

Hi Andyzn,

感谢您在此发帖。

我建议你可以尝试使用libpng库设置压缩级别,然后使用GDI +绘制图片。

I suggest that you can try to use the libpng library to set the compression level, then to draw the picture using GDI+.

libpng是
官方PNG参考图书馆。 它支持几乎所有PNG功能,是可扩展的。 版本1.2.6和1.0.16可以在PNG数据流中写入无效的zlib头。 这听起来并不像听起来那么糟糕,因为双字节标题可以很容易地校正
(例如,使用pngcrush重写图像,或许,稍微更好地压缩它们。

libpng is the official PNG reference library.  It supports almost all PNG features, is extensible.  Versions 1.2.6 and 1.0.16 can write an invalid zlib header within the PNG datastream.  This is not quite as bad as it sounds since the two-byte header can be corrected fairly easily (e.g., use pngcrush to rewrite the images and, perhaps, compress them slightly better.

您也可以尝试 OptiPNG
OptiPNG 是一个PNG优化器将图像文件重新压缩为较小的尺寸,而不会丢失任何信息。

You also can try the OptiPNG. OptiPNG is a PNG optimizer that recompresses image files to a smaller size, without losing any information.

如果您的问题已经解决,请记得通过将有用的帖子标记为答案来关闭您的帖子对于同样问题的其他人可能会有所帮助。

If your issue has been resolved, please remember to close your thread by marking useful posts as answer that can be helpful for other person with same issue.

最好的问候,

Hart

注意:此回复包含对第三方万维网站点的引用。微软提供此信息是为了方便您。微软不控制这些站点,也没有测试在这些站点上找到的任何软件或信息;因此,
Microsoft无法对质量,安全性或su进行任何陈述在那里发现的任何软件或信息的可用性。

Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.


这篇关于如何在使用windows gdi +生成png期间更改zip级别(从0x785E到0x78DA)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆