PHP浮雕与颜色 [英] PHP emboss with color
问题描述
我需要对PHP中的图像进行浮雕效果。但我需要保持真实的颜色,如 http://loriweb.pair.com /8udf-emboss.html
I need to make an emboss effect for an image in PHP. But I need to keep the real color, like the globe picture in http://loriweb.pair.com/8udf-emboss.html
我的最终目标是使这样的效果 http://www.flickr.com/photos/52700219@N06/6729984045/in/photostream/ 我只能使用像这样 http://www.flickr.com/photos/52700219@N06/6759029339/
My final target is to make effect like this http://www.flickr.com/photos/52700219@N06/6729984045/in/photostream/ and I can only make it like this http://www.flickr.com/photos/52700219@N06/6759029339/ by giving grey line for each square there.
到现在为止,我只找到压纹效果,这将使图像颜色变成灰色像
当使用图像卷积或IMG_FILTER_EMBOSS。
我如何做到这一点?
Until now, I only find emboss effect that will make the image color become gray like when using imageconvolution or IMG_FILTER_EMBOSS. How can I do this?
推荐答案
通用卷积内核。您可以使用 imageconvolution()
来实现相同的效果:
The emboss effect that you showed on the "globe" example is just a generic convolution kernel. You can accomplish the same effect using imageconvolution()
:
$kernel = array(array(1, 1, -1), array(1, 1, -1), array(1, -1, -1));
imageconvolution($image, $kernel, 1, 0);
这篇关于PHP浮雕与颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!