Generic bevel and emboss

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
andy82

Generic bevel and emboss

Post by andy82 »

Hi,

is there a generic way to reproduce the "Bevel and emboss" filter from Photoshop in ImageMagick? I've already found the following thread on this topic:
http://studio.imagemagick.org/discourse ... 54&start=0

But the method described in this thread only seems to apply to images that use a static foreground color (e.g. text images). What I'm looking for is a more general approach, i.e. I'd like to apply the bevel and emboss filter to normal images that contain lots of different colors instead of just a single foreground color. Any ideas?

Thanks a lot,

Andy
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Generic bevel and emboss

Post by snibgo »

If you post a before and after example, someone might suggest something.
snibgo's IM pages: im.snibgo.com
andy82

Re: Generic bevel and emboss

Post by andy82 »

Ok, here is an example! This is the source image:

Image
(from http://cairographics.org/cairo-banner.png)

And here is the same image with "bevel and emboss" Photoshop filter applied:

Image

Note that it is a single filter in Photoshop. It's not two separate filters as the name might suggest... it's a single filter called "bevel and emboss". I wouldn't be surprised if Gimp has this filter too because it's very common, so I was wondering if it can be easily replicated with ImageMagick.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Generic bevel and emboss

Post by fmw42 »

I did the emboss half in my unix script, emboss, at the link below. GIMP and PHotoshop use different techniques. I implemented an approximation to both. I created an innerbevel (and Anthony Thissen helped me improve that) and put that in my script, texteffects. But Anthony shows you how to do that on his page at http://www.imagemagick.org/Usage/fonts/#inner_bevel. I have tried using the Photoshop technique for innerbevel, but did not like the results as well as with this technique.

P.S. My old PS CS does not seem to have the combined emboss/bevel tool. What version of PS are you on?
andy82

Re: Generic bevel and emboss

Post by andy82 »

I did the emboss half in my unix script, emboss, at the link below. GIMP and PHotoshop use different techniques. I implemented an approximation to both. I created an innerbevel (and Anthony Thissen helped me improve that) and put that in my script, texteffects. But Anthony shows you how to do that on his page at http://www.imagemagick.org/Usage/fonts/#inner_bevel. I have tried using the Photoshop technique for innerbevel, but did not like the results as well as with this technique.
Please correct me if I'm wrong here, but both solutions don't really fit my case, do they? I mean, for static colored text there's already the method described in this thread
http://studio.imagemagick.org/discourse ... 54&start=0
and it yields very good results. What I'm looking for is how to get this method to work with images that have multiple colors instead of a static fill color like the text...
P.S. My old PS CS does not seem to have the combined emboss/bevel tool. What version of PS are you on?
Your version must have the bevel & emboss filter because I'm using an ancient version of Photoshop here (v5.5) too. You might have looked in the wrong place for it. The bevel & emboss filter is available in the layer options dialog. Just insert a new layer, then select layer options in the layer's right mouse context menu and then you will see different options for the layer, e.g. layer shadow, inner glow, outer glow, color fill, and also the magic bevel & emboss filter :-)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Generic bevel and emboss

Post by fmw42 »

Please correct me if I'm wrong here, but both solutions don't really fit my case, do they? I mean, for static colored text there's already the method described in this thread
http://studio.imagemagick.org/discourse ... 54&start=0
and it yields very good results. What I'm looking for is how to get this method to work with images that have multiple colors instead of a static fill color like the text...
Just create the bevel as a graylevel image and put it into the alpha channel, then flatten over some background color or compose multiply -composite to accentuate the colors in the image with the bevelled graylevel image.


Your version must have the bevel & emboss filter because I'm using an ancient version of Photoshop here (v5.5) too. You might have looked in the wrong place for it. The bevel & emboss filter is available in the layer options dialog. Just insert a new layer, then select layer options in the layer's right mouse context menu and then you will see different options for the layer, e.g. layer shadow, inner glow, outer glow, color fill, and also the magic bevel & emboss filter
I will take a closer look again. I had not looked in the layer dialog.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Generic bevel and emboss

Post by fmw42 »

OK, I see it now.

But tell me the exact and complete steps (including buttons and slider values) you used in PS to convert your input into your output image, especially what you did with regard to adding any new layers and processing them. If helpful, provide screen snaps to supplement, so that I can duplicate your results. I am not real adept at using PS. Then perhaps I can suggest a way to do that in IM.

If you want, you can contact me directly: fmw at alink dot net

Here is an example of using my emboss script on your image.

emboss -m 2 -d 10 -a 135 -c pegtop_light -i 40 1z3xh15.png 1z3xh15_test2j.png

Image

With a little work it could be improved to match your result better.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Generic bevel and emboss

Post by anthony »

The PS method appears to be smoothed a bit.

The basic technqique is to get the image, and convert it into a mask. that is bevels using the methods given in IM examples.

Once you have that mask the result using the previously generated mask, and then use a hardlight or overlay composition method (or one of the many other 'lighting' composition methods to combine it with the original colored image. that will re-color the grey, or add shading to the original (depends on how you look at it).

see the notes in
Image Composition, Lighting Composition Methods
http://www.imagemagick.org/Usage/compose/#light

Also see...
Image Transformations, Creating Overlay Highlighting
http://www.imagemagick.org/Usage/transf ... de_overlay
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
andy82

Re: Generic bevel and emboss

Post by andy82 »

But tell me the exact and complete steps (including buttons and slider values) you used in PS to convert your input into your output image, especially what you did with regard to adding any new layers and processing them. If helpful, provide screen snaps to supplement, so that I can duplicate your results. I am not real adept at using PS. Then perhaps I can suggest a way to do that in IM.
Actually, I just used the default values set by Photoshop. Here are the instructions to reproduce it:

1) Open cairo-banner.png in PS.

2) Mark the whole image, press CTRL+C to copy it to the clipboard, then press CTRL+N to create a new image (select "white" as background), then press CTRL+V to paste the image from the clipboard as a new layer into the new image.

3) Now open the the options dialog for the layer and activate "bevel and emboss". Here is my configuration for the bevel and emboss, but it's actually the PS default settings, I didn't change anything:

http://i45.tinypic.com/2gtq0s9.jpg

Unfortunately, my version is in German language. Bevel and emboss is "Abgeflachte Kante und Relief" in German. Please let me know if you need to know more translations of a specific GUI elements.

Thanks alot!
andy82

Re: Generic bevel and emboss

Post by andy82 »

By the way, this is how bevel and emboss looks when applying it to an image without transparency:

Before:
Image

After:
Image
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Generic bevel and emboss

Post by fmw42 »

User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Generic bevel and emboss

Post by fmw42 »

1) Open cairo-banner.png in PS.

2) Mark the whole image, press CTRL+C to copy it to the clipboard, then press CTRL+N to create a new image (select "white" as background), then press CTRL+V to paste the image from the clipboard as a new layer into the new image.

3) Now open the the options dialog for the layer and activate "bevel and emboss". Here is my configuration for the bevel and emboss, but it's actually the PS default settings, I didn't change anything:
Thanks that was enough for me to reproduce your result. One thing was that your original image had no alpha channel, but the one you linked to did. I used the latter. The alpha channel is important.

I am not too sure what the difference is between outerbevel and emboss. I can see they are different, but I thought they were supposed to be pretty much the same. Anyway, I think I can come up with something closer for innerbevel and possibly either outerbevel or emboss, now. I will try to work on a script next week. But they have a lot of controls that I need to work out, even for the default situation. So it may take some time. I will post back here when I get something reasonable accomplished.

Fred
andy82

Re: Generic bevel and emboss

Post by andy82 »

the latter can be done with IM -raise or -frame
Thanks. The plain -raise doesn't look as good as in PS, though. But I think the following hard-light effect which blurs the raise bevel seems to come a bit closer to the PS bevel and emboss - at least for non-transparent images. See here:
http://www.imagemagick.org/Usage/compose/#hardlight

Image
So it may take some time. I will post back here when I get something reasonable accomplished.
Sure, no hurry. Thanks for your efforts!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Generic bevel and emboss

Post by fmw42 »

I have created a script, bevelborder, to apply a bevel effect to the border of an image. This is a first step. I am well on the way to a more general script to apply bevels to an image with an alpha channel as shown above in a manner similar to Photoshop.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Generic bevel and emboss

Post by anthony »

You can generate transparent frame effects directly using the Frame Command.
Shave the original image, frame using a Transparent color and underlay the original image!

Code: Select all

convert rose:  -shave 10x10 \
            -matte -mattecolor '#CCC6' -frame 10x10+3+4 \
            rose: +swap -composite  show:

Improvements is to replace the shaved image with transparency, create frame with pure grey, and then use one of the Lighting Compose Methods. WARNING: watch the order of lighting methods some like the images to be swapped.

Code: Select all

convert rose:  \
            \( +clone -shave 10x10 -fill gray50 -colorize 100%  \
            -mattecolor gray50 -frame 10x10+3+4 \) \
            -compose VividLight -composite  show:
Adding this to the Self Framing section of Thumbnails (adding Fluff)
http://www.imagemagick.org/Usage/thumbnails/#self_frame

I have expanded this section with this internal framing technique.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply