在PHP中,imagepng()接受过滤器参数。这些过滤器如何影响功能的输出? [英] In PHP, imagepng() accepts a filter parameter. How do these filters affect the function's output?

查看:211
本文介绍了在PHP中,imagepng()接受过滤器参数。这些过滤器如何影响功能的输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这些过滤器如何影响PHP中 imagepng()的输出?

How do these filters affect the output of imagepng() in PHP?


  • PNG_NO_FILTER

  • PNG_FILTER_NONE

  • PNG_FILTER_SUB

  • PNG_FILTER_UP

  • PNG_FILTER_AVG

  • PNG_FILTER_PAETH

  • PNG_ALL_FILTERS

  • PNG_NO_FILTER
  • PNG_FILTER_NONE
  • PNG_FILTER_SUB
  • PNG_FILTER_UP
  • PNG_FILTER_AVG
  • PNG_FILTER_PAETH
  • PNG_ALL_FILTERS

文档简单地说,A特殊的PNG过滤器,由imagepng()函数用于每一个。

The documentation simply says, "A special PNG filter, used by the imagepng() function" for each of them.

似乎使用PNG_NO_FILTER会减少输出的文件大小,但除此之外,我不确定它是如何受到影响的。任何见解都会非常感激。

It seems that using PNG_NO_FILTER will reduce the filesize of the output, but other than that, I am unsure as to how it is affected. Any insight would be really appreciated.

推荐答案

根据 http://www.w3.org/TR/PNG-Filters.html 这些过滤器的目的是准备图像数据最佳压缩。

According to the PNG Specifications at http://www.w3.org/TR/PNG-Filters.html The purpose of these filters is to prepare the image data for optimum compression.


使用无过滤器,扫描线是未经修改的
传输;在数据之前插入过滤器类型字节
只需要

With the None filter, the scanline is transmitted unmodified; it is only necessary to insert a filter type byte before the data.

子过滤器传输每个字节与$ b对应字节的
值之间的
差异$ b之前的像素。

The Sub filter transmits the difference between each byte and the value of the corresponding byte of the prior pixel.

向上过滤器就像Sub
过滤器一样,只是在当前像素正上方的像素

而不仅仅是它的左边,使用
作为预测器。

The Up filter is just like the Sub filter except that the pixel immediately above the current pixel, rather than just to its left, is used as the predictor.

平均过滤器使用两个相邻像素(左边和上面
)的
的平均值来预测值一个
像素。

The Average filter uses the average of the two neighbouring pixels (left and above) to predict the value of a pixel.

Paeth过滤器计算三个
相邻像素的简单
线性函数(左上,上
left),然后选择最接近
计算值的
相邻像素作为预测器。这项技术应付给Alan W. Paeth [PAETH]
。*

The Paeth filter computes a simple linear function of the three neighbouring pixels (left, above, upper left), then chooses as predictor the neighboring pixel closest to the computed value. This technique is due to Alan W. Paeth [PAETH].*

这篇关于在PHP中,imagepng()接受过滤器参数。这些过滤器如何影响功能的输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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