PHP浮雕与颜色 [英] PHP emboss with color

查看:129
本文介绍了PHP浮雕与颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要对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屋!

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