PHP imagefilter函数参数IMG_FILTER_PIXELATE问题
有人可以详细解释一下IMG_FILTER_PIXELATE
参数附加值每个参数的范围是什么,它们可以是负数值,浮点数值以及它们到底做什么?
Can some one explain the IMG_FILTER_PIXELATE
parameters additional values in detail what is the range for each parameter, can they negative numbers values, float number values and what exactly do they do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以供将来参考,成为实现 IMG_FILTER_PIXELATE 的那个。
这两个附加参数的工作原理如下:
更深入地了解“高级”像素化与“简单”像素化:
对于简单模式,用于块的颜色是该块中的第一个像素,但对于高级模式,使用的颜色将是所有像素的“平均”颜色块中的像素,这意味着在内部所有像素都会被迭代并添加到 RGB 值数组中,并使用其平均颜色,这意味着将使用更多的 CPU 时间来计算所使用的实际颜色。
尽管是一篇旧文章,但我希望这对未来的读者有用。
For future reference, being the one that implemented IMG_FILTER_PIXELATE.
The two additional parameters works as follows:
A bit more in depth about the 'advanced' pixelation vs 'simple':
For simple mode, the color used for the block is the first pixel in that block, but for advanced mode the color used will be an "average" color of all the pixels in the block, meaning internally all pixels are iterated and added to an array of RGB values and the average color of that is used, meaning there will be used more CPU time calculating the actual color used.
Despite being an old post, I hope this may be useful for future readers.
您也询问过其他一些过滤器。请阅读
imagefilter
的手册页 ,您会发现第一个参数是以像素为单位的块大小,第二个参数是一个布尔值,用于更改“高级像素模式”,无论这意味着什么。范围是多少?那么第二个是 bool,所以这将是 0/1/true/false/whatever。但首先是像素化中块的大小。您为什么认为可能需要负数?当您给它否定时会发生什么?它吓坏了吗?让它变成零吗?碰撞?烧伤?毁灭世界?不,该死的。线索。自己尝试一下,会很有趣的!可能发生的最坏的情况是什么。
You have asked this about some of the other filters as well. Please read the manual page for
imagefilter
, on which you will discover that the first argument is the block size in pixels and the second argument is a boolean that changes the "advanced pixel mode", whatever that means.What's the range? Well the second is a bool, so that'll be 0/1/true/false/whatever. But the first is the size of the blocks in the pixelation. Why would you think it might take a negative? What happens when you do give it a negative? Does it freak out? Make it a zero? Crash? Burn? Destroy the world? No. Freaking. Clue. Try it out yourself, it'll be fun! What's the worst that could happen.