gpt4 book ai didi

php - 在 PHP 中,imagepng() 接受一个过滤器参数。这些过滤器如何影响函数的输出?

转载 作者:IT王子 更新时间:2023-10-28 23:53:31 26 4
gpt4 key购买 nike

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

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

The documentation简单地说,“一个特殊的 PNG 滤镜,由 imagepng() 函数使用”。

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

最佳答案

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

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

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

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.

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 - 在 PHP 中,imagepng() 接受一个过滤器参数。这些过滤器如何影响函数的输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3048382/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com