Making images highlight darker or lighter areas

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?".
Post Reply
mrburnzie
Posts: 7
Joined: 2016-12-08T04:20:42-07:00
Authentication code: 1151

Making images highlight darker or lighter areas

Post by mrburnzie »

Hi!

I'm having trouble figuring out how to highlight darker and lighter areas of the image.
I was trying using

Code: Select all

convert in.jpg +contrast out.jpg
and

Code: Select all

convert in.jpg -contrast out.jpg
, but that's not it.

I would like to apply effects like "shadow" and "highlight" to my images. (darker and lighter)

Any suggestions? Thx!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Making images highlight darker or lighter areas

Post by snibgo »

I don't understand what you want. Perhaps you can link to "before" and "after" examples.
snibgo's IM pages: im.snibgo.com
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Making images highlight darker or lighter areas

Post by Bonzo »

I assume the OP wants to lighten shadow areas in a photo to show more detail and to darken lighter areas again to show more detail.
mrburnzie
Posts: 7
Joined: 2016-12-08T04:20:42-07:00
Authentication code: 1151

Re: Making images highlight darker or lighter areas

Post by mrburnzie »

Yes, Bonzo is right. :)
mrburnzie
Posts: 7
Joined: 2016-12-08T04:20:42-07:00
Authentication code: 1151

Re: Making images highlight darker or lighter areas

Post by mrburnzie »

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

Re: Making images highlight darker or lighter areas

Post by snibgo »

A simple way is:

Code: Select all

convert in.png ( +clone -blur 0x5 +level 55,45%% ) -compose HardLight -composite out.png
Adjust the blur and level as required. You might prefer to adjust only the lightness of the image.

I show some other methods on my pages "Adaptive auto level and gamma" and "[Adaptive] Contrast-limited equalisation".
snibgo's IM pages: im.snibgo.com
mrburnzie
Posts: 7
Joined: 2016-12-08T04:20:42-07:00
Authentication code: 1151

Re: Making images highlight darker or lighter areas

Post by mrburnzie »

Thanks, will try it out! :)
mrburnzie
Posts: 7
Joined: 2016-12-08T04:20:42-07:00
Authentication code: 1151

Re: Making images highlight darker or lighter areas

Post by mrburnzie »

I'm getting +clone: command not found :(

To be specific:

Code: Select all

+clone: command not found
fish:  +clone -blur 0x5 +level 55,45%% 
       ^
in command substitution
        called on standard input

convert: no images defined `out.jpg' @ error/convert.c/ConvertImageCommand/3210.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Making images highlight darker or lighter areas

Post by snibgo »

I should have said: my command is Windows BAT syntax. For bash or other shells, you may need to adjust it, eg escape the parentheses: \( and \).
snibgo's IM pages: im.snibgo.com
mrburnzie
Posts: 7
Joined: 2016-12-08T04:20:42-07:00
Authentication code: 1151

Re: Making images highlight darker or lighter areas

Post by mrburnzie »

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

Re: Making images highlight darker or lighter areas

Post by fmw42 »

You can try -brightness-contrast. It has better control than -contrast.
Post Reply