How to make this image effect, any library that can help with it
Do you know if an emboss effect like this can be done with a programming package. Can someone suggest something
开发者_开发百科Typically simple effects like this are implemented using a convolution kernel, where an image is transformed from its source to a new copy. Each new pixel is computed as a linear combination (i.e. a weighted sum) of its source pixel and a subset of its neighbors within the source image.
As an example, you might (abstractly) define a kernel such as:
0 0 0
0 9 -3
0 -3 -3
Here, the center of the matrix represents the weighting applied to the corresponding source pixel for each new pixel value to be computed. The surrounding values represent the weighting that should be applied to the corresponding neighbor pixels before summing to compute the new pixel's total value.
In practice, this might be applied to create a new embossed image with the following pseudocode:
for y in source.height:
for x in source.width:
newImage[x,y] = source[x,y]*9
+ source[x+1,y]*-3
+ source[x,y+1]*-3
+ source[x+1,y+1]*-3
There are obvious implementation details left out, such as how to handle the edge of the image (one option is to assume the image is mirrored about its edges), as well as actually applying an arbitrary matrix of coefficients rather than hard-coding the weighted sum as above. Hopefully this at least conveys how simple the operation really is at its core.
With GD:
- create a new transparent image with the size of the original one - imagecreatetruecolor()
- draw the text in that image - imagettftext() / imagettfbbox() - hint:
IMG_COLOR_TRANSPARENT
- apply the
IMG_FILTER_EMBOSS
filter - imagefilter() - copy the embossed text over the original image - imagecopymerge()
This may help: http://www.imagemagick.org/Usage/fonts/
Looks like the tags figured it out for you... This looks like something that'd be right up ImageMagick's alley.
Check out here for some good PHP ImageMagick watermark examples.
精彩评论