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?".
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 »

Anthony,

That was basically what I did in my scripts. But I had to threshold the frame between shadows and highlights as the high lights needed a screen compose and the shadows needed a multiply compose. (A compound compose would be very useful, with threshold values for where to use screen and where to use multiply --- basically a compose that brightens above a threshold and darkens below another threshold).

I also added transparency to the frame masks and also contrast adjustments to the frame and used the frame coloring as well.

In my imageborder script, I used the unfolded/extended image under the frame. But in my new bevelborder, I created a frame image around a smaller gray image so that the total was the size of the image and composed the frame over the image.
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 »

fmw42 wrote:Anthony,

That was basically what I did in my scripts. But I had to threshold the frame between shadows and highlights as the high lights needed a screen compose and the shadows needed a multiply compose. (A compound compose would be very useful, with threshold values for where to use screen and where to use multiply --- basically a compose that brightens above a threshold and darkens below another threshold).
Both Hardlight and Overlay is exactly this (only difference between them is image order). Anything darker than 50% is multiplied, anything greater than 50% is screened. near 50% has little to no effect.

Softlight is similar but does not go to maximum black and white. Other light methods also work in similar ways, with similar effects, though Vivid Light has effects that enhance primary colors.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
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 »

Both Hardlight and Overlay is exactly this (only difference between them is image order). Anything darker than 50% is multiplied, anything greater than 50% is screened. near 50% has little to no effect.
Guess I did not read your docs carefully enough. But I used two different thresholds (25 and 75: which may or may not be necessary) and had to add transparency and contrast. I will look into whether I can simplify my two scripts with hardlight or overlay. Thanks.
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 »

fmw42 wrote:
Both Hardlight and Overlay is exactly this (only difference between them is image order). Anything darker than 50% is multiplied, anything greater than 50% is screened. near 50% has little to no effect.
Guess I did not read your docs carefully enough. But I used two different thresholds (25 and 75: which may or may not be necessary) and had to add transparency and contrast. I will look into whether I can simplify my two scripts with hardlight or overlay. Thanks.
Not a problem I did the same thing in my Advanced Shaded Logo Examples. I kept the more complex one, but added the simplier one created using HardLight/Overlay to the examples.

Making Logos 3-D
http://www.imagemagick.org/Usage/advanced/#3d-logos
Better 3-D Logo Generation
http://www.imagemagick.org/Usage/advanced/#3d-logos-2

Now that I am finally getting an understanding on the other lighting effects I can use them as well.
I just need to get examples for different effects, and a summary written up.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
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 to admit that the various composition settings are still much a mystery to me and I am still learning about them. I often tend to do things a harder way since I don't realize that some compose setting will do it in one step.
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 »

Neither did I, which is why it has taken me years to figure out what I have. Also why I was unable to 'fix' some of them when I first looked at the composition source in 2005. At least as of the end of last year I am pretty certain I have the operators working properly when is why I am now starting to actually understand them better.

The problem was that while there are pleanty of photoshop docs listing the compose settings, and some examples that use them. There is now guides or documentation on how to actually use them!!!!

I think IM Examples is about the first guide that is even trying to do this in a publicly available way.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
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 »

anthony wrote: The problem was that while there are pleanty of photoshop docs listing the compose settings, and some examples that use them. There is now guides or documentation on how to actually use them!!!!

I think IM Examples is about the first guide that is even trying to do this in a publicly available way.
That was also partially why I included them in my earlier emboss script (http://www.fmwconcepts.com/imagemagick/emboss/index.php), to see what they did on a real image rather than just a gradient-like image. Nevertheless, I still don't have that good an idea.

I thought your math formulae were useful, but then I did not read past that when I was looking to see if there was a split screen/multiply and missed the fact that hardlight was probably what I was looking for. So I reinvented it with thresholding and masking. It looked like it needed two thresholds as I could not get some things working at a simple 50% threshold for both. But I have to revisit that in the three cases that I have or am trying to use it. Since I made some improvements, the 50% split may just work now.
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 »

fmw42 wrote:That was also partially why I included them in my earlier emboss script (http://www.fmwconcepts.com/imagemagick/emboss/index.php), to see what they did on a real image rather than just a gradient-like image. Nevertheless, I still don't have that good an idea.
I think your images need swapping for the dodge/burn/light methods.

Overlay came out reasonable, but hardlight does not look right. It looks like the white background is being used as a highlight, rather than as a color. Sure sign the images are not swapped!

Try applying the Light against a pure gray scale image. The right order will produce no changes.

Here is a nice Rule of Thumb...

In the 'gradient' map of the operator (showing in IM examples) the correct order depends on if the image has a normal linear gradient along the center line either vertically or horizontally. If is Horizontal as in HardLight, so the source (overlay) should be the grayscale lighting mask (pure grey -> no-op in destination). In Overlay it is the vertical center line that has a linear gradient so it is the destination image that should be the greyscale lighting mask.

Light methods appear to like to overlay a lighting mask.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
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 »

Overlay came out reasonable, but hardlight does not look right. It looks like the white background is being used as a highlight, rather than as a color. Sure sign the images are not swapped!
Are you saying that the order of src and dst images is not consistent for all compose methods? If that is really the case, then would it not make sense to fix those internally in IM so that one has consistent behaviour (or is there some good reason that they need to be the way they are)?

I used the same ordering for all the compose methods in my emboss:

convert faceimage imagefromshading -compose composemethod -composite resultimage
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 »

What I am saying is that some methods what the source to be the grey-scale lighting mask, while others want that to be the destination. Basically are you adding color to a grey-scale image? Or are you adding a lighting effect to a color image.

I can't change this in IM as it is following the same conventions used by SVG and Photoshop conventions!

The Lighting methods appear to like to 'overlay' the grey-scale lighting effect, which makes sense.

However Overlay is designed to overlay color to a grey-scale surface (such as what 'shade' produces).

Not all compose methods are used the same way! And sometimes swapping the method actually produces a better result! Sometimes you need to add or remove contrast to the lighting effect to get a better result.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
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 »

Anthony, if you know which order they need to be used, could you add that to your Examples page for compose (or at least identify which ones need to be swapped from the usual convention of

convert image grayscaleimage -compose composemethod -composite result

That would be very helpful. Then I can adjust my emboss script (and possibly bevelborder and imageborder) for those and any other script that I create in the future. You have much more experience on these matters and I still don't understand them well enough to know.

Some of your compose methods only show how they affect a gradient and not how one would apply them to a real image. If not too much trouble, if this makes sense, could you add examples their use on real images. Or perhaps a table page like in my emboss that shows how some grayscale image (like a frame?) is applied to one common (small) image with each (appropriate) compose method noting which order they need to be applied. Just a thought that could be very helpful in picking out the right compose for a given effect and learning what each compose method does. This is not urgent - whenever convenient. If I can help, let me know.
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 »

I plan too. But getting a good image that shows the results well has been a problem.

However the recent frame embossing methods seem to be pretty good for this purpose.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
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 »

anthony wrote:I plan too. But getting a good image that shows the results well has been a problem.

However the recent frame embossing methods seem to be pretty good for this purpose.

That was what I was thinking, too.
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 finally finished my generic, bevel, script that does inner bevel or outer bevel or (both) emboss. See script at link below.
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 »

Very nice. I particularly like the effects of tapered outer bevels :-)

Can you specify the outer bevel color? For example to overlay it on a different color background (other than gray50).
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply