Search code examples
phpimagecolorsemboss

PHP emboss with color


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

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.

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?


Solution

  • 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);