I am trying to emboss an image using PIL.
PIL provides a basic way to emboss an image ( using ImageFilter.EMBOSS).
In image editing packages like GIMP, you can vary parameters like Azimuth, depth and elevation in this embossed image.
How to do this with PIL? At the very least I want to adjust the “depth” of the embossed image.
Update: I tried things suggested by Paul (modifying the filterargssuch as scale, offset and the matrix), but I couldn’t change the “depth” effect. So still looking for an answer.
Here is the comparison of embossing effect using PIL (left) and GIMP (right). The original picture is located here, http://www.linuxtopia.org/online_books/graphics_tools/gimp_advanced_guide/gimp_guide_node74.html.

If you cannot achieve your goal by using or combination of operations (like rotating, then applying the EMBOSS filter, the re-rotating), (or enhancing the contrast then embossing) then you may resort to changing (or creating your own) filter matrix.
Within ImageFilter.py you will find this class:
Placing a -1 in a different corner of the matrix will change the azimuth and making it a -2 may have the effect you are looking for.
The matrix is applied pixel-by-pixel. Each element in the matrix corresponds to the current pixel and surrounding pixels; the center value representing the current pixel. The new, transformed current pixel will be created as a combination of all 9 pixels, weighted by the values in the matrix. For example, a matrix with all zeros and a 1 in the center will not change the image.
Additional parameters are
scaleandoffset. For the built-in EMBOSS, the values are 1 (scale) and 128 (offset). Changing these will change the overall strength of the result.From ImageFilter.py:
As I am unfamiliar with the effects of GIMP’s “depth” parameter, I cannot say which is most likely to do what you want.
You can also make the matrix a different size. Replace the (3,3) with (5,5), and then create 25-element matrix.
To make temporary changes to the filter without re-saving source code, just do this:
Edit: (taking the NumPy approach)
I hope this helps. I can see now why you were disappointed with PIL’s results. Wolfram Mathworld is a good resource for a vector algebra refresher.
Before
After