Category: Graphics Code  ·  Originally posted June 14, 2010  ·  Last updated February 1, 2011

Generating Emboss / Engrave / Relief Filters (in VB6)

Bayonetta is quite possibly the best action game I've ever played - yes, even better than God of War III

I’ve had this code ready for months, but I couldn’t bring myself to post it until I added something more exciting than just “emboss” and “engrave.”

Today is that day!

First, let me mention what emboss/engrave actually do. These are two of the simplest image processing filters, and they can be efficiently implemented in pretty much any programming language. They both operate on the same principle – for each pixel, subtract the RGB values of one or more neighboring pixels in a particular direction. This leads to an image where low-contrast areas are all black, while high-contrast areas (edges) are varying colors of brighter intensity. Most emboss/engrave filters add 127 to the RGB values so that uniformly contrasted areas are gray. As a bonus feature, I’ve added a “color” option to this code, so you can emboss/engrave an image to any hue. In the Bayonetta example above, the left side of the picture is embossed to something around #81a3fe.

Relief is a variation on emboss/engrave, where the base color is not artificially generated but is based off the current pixel. This acts almost like a sharpen filter, but because the filter doesn’t operate in all directions, it lends the image a more artificial look. (Hence the “relief” moniker – on certain images, it looks like an image has been chipped out of stone and then painted.) Try it on a photo – they tend to work best!

This site - and its many free downloads - are funded by donations from visitors like you.
Please consider a small donation to fund server costs and to help me support my family.
Even $1.00 helps. Thank you!

 

bookmark and share this article

Email this article to a friend Print a copy of this article Subscribe to article comments Bookmark this article on Delicious Submit this article to reddit Submit this article to Digg Submit this article to StumbleUpon Share this article on Facebook Tweet this article

related articles

Discussion (Be the first to comment!)

Public comments are closed for this article. Private comments may be submitted using this link.

Comments are closed.