Reputation: 19242
Do you know if an emboss effect like this can be done with a programming package. Can someone suggest something
Upvotes: 2
Views: 879
Reputation: 15216
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.
Upvotes: 0
Reputation: 154553
With GD:
IMG_COLOR_TRANSPARENT
IMG_FILTER_EMBOSS
filter - imagefilter()Upvotes: 2
Reputation: 3596
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.
Upvotes: 2