PNG压缩在.net中 [英] PNG Compression in .net

查看:417
本文介绍了PNG压缩在.net中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想压缩位图巴与不同的压缩级别,因为这些级别是在C#JPEG压缩可用。我有不同尺寸的20至30的图像,以1秒处理。是否有任何库来实现这一压缩PNG用不同的压缩级别?

I want to compress bitmaps to PNG with different compression levels as these levels are available in JPEG compression in C#. I have 20 to 30 images of different sizes to process in 1 sec. Is there any library to achieve this compression in PNG with different compression levels?

推荐答案

一个无损压缩方法并不一定是单质量水平。我的意思是,一些无损压缩方法具有一些参数来选择的速度/压缩比的折衷。这是给作者。

A lossless compression method does not have to be single quality level. I mean, some lossless compression methods have some parameters to choose speed/compression ratio trade-off. It's up to author.

至于PNG压缩,它实际上是一堆过滤器和紧缩算法。考虑放气具有冗余编码阶段(例如两个不同的压缩机可以产生完全不同的输出,但他们仍然可以通过任何有效的解压缩解压缩),这也难怪几个节目输出不同的PNG图像。需要注意的是,我仍然没有采取滤镜考虑。有几个过滤器和没有最好的过滤器,即它的质量通过图像变化。

As to PNG compression, it's actually bunch of filters and deflate algorithm. Considering deflate has a redundant encoding stage (e.g. two different compressors can produce completely different output, yet still they can be decompressed by any valid decompressor), it's no wonder several programs outputs different PNGs. Note that, I'm still not taking filters into account. There are several filters and there is no "best" filter i.e. it's quality varies by image.

由于它的冗余功能,有的人写了采取定期PNG PNG优化作为输入,以产生更小的PNG没有任何知觉丧失。他们中的一些应用一些技巧,如一些可预见的颜色填充完全透明​​的区域,以增加压缩。但是,一般他们调整了蛮力时尚参数

Due to it's redundant feature, some people wrote PNG optimizers which take a regular PNG as input to produce smaller PNG without any perceptual loss. Some of them applies some tricks such as filling completely transparent area with some predictable colors to increase compression. But, in general they tweak parameters in a brute-force fashion.

现在,你的问题简单的答案可能是因为你有两个选择:

Now, simplest answer for your question could be that you have two options:


  1. 如果你要运行在桌面环境的可执行文件,你可以使用的这些工具作为优化。但是,在共享主机,你不能用它们由于可能的特权。

  2. 您可以在.NET中,考虑到一些蛮力参数整定写自己的PNG作家。

  1. If you're going to run your executable on a desktop environment, you can use one of these tools as an optimizer. But, in shared hosting you can't use them due to possible privileges.
  2. You can write your own PNG writer in .NET that takes into account some brute-force parameter tuning.

这篇关于PNG压缩在.net中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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