Softlight

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
alasdairdf
Posts: 53
Joined: 2012-05-15T04:56:50-07:00
Authentication code: 13

Softlight

Post by alasdairdf » 2014-12-07T12:08:03-07:00

Hello,

I need to do a transformation with IM that acts like Photoshop's softlight. IM's softlight composite mode gave me a completely different looking result to how Photoshop does it.

Does anyone know what the difference is and how I can imitate a Photoshop-style softlight filter?

The reason for all of this is that I found that if I do an IM -equalize on an image, then put that image on top of the original on Photoshop and apply softlight filter to the top (equalized) layer, the result is like a supremely awesome auto-level (better than Photoshop's autotone). But I need to be able to do this with IM only and the softlight not acting as expected makes it not work. Any ideas?

Thanks,
Alasdair

Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Softlight

Post by Bonzo » 2014-12-07T12:34:46-07:00

I would suggest you upload the result from Photoshop and IM so people could see what the difference is.

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

Re: Softlight

Post by fmw42 » 2014-12-07T13:13:42-07:00

Also provide your input image(s). You can upload to some free service such as dropbox.com and post the URLs here.

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

Re: Softlight

Post by fmw42 » 2014-12-07T13:35:54-07:00

Seems to work fine for me with IM 6.9.0.0 Q16 Mac OSX

original:
Image

equalize in IM:

Code: Select all

convert zelda3_plevel20.jpg -equalize zelda3_plevel20_eq.png
Image


Softlight compose in IM:

Code: Select all

convert zelda3_plevel20.jpg zelda3_plevel20_eq.png -compose softlight -composite zelda3_plevel20_eq_softlight.png
Image


Softlight compose in PS:
Image

Code: Select all

compare -metric rmse zelda3_plevel20_eq_softlight.png zelda3_plevel20_eq_softlight_ps.png null:
287.83 (0.00439201)

75% softlight effect in IM:

Code: Select all

convert zelda3_plevel20.jpg \
\( zelda3_plevel20_eq.png -alpha set -channel a -evaluate set 75% +channel \) \
-compose softlight -composite zelda3_plevel20_eq_softlight_75.png
Image


What version of IM and platform are you using? Please, always provide this information when asking questions on this form.

alasdairdf
Posts: 53
Joined: 2012-05-15T04:56:50-07:00
Authentication code: 13

Re: Softlight

Post by alasdairdf » 2014-12-07T22:09:25-07:00

Oh wow! (Edit: apparently w0w is changed to ???) I feel like a bit of an idiot. What I was typing was:

Code: Select all

convert test.png -compose softlight -composite equalize.png softlight1.png
Instead of:

Code: Select all

convert test.png equalize.png -compose softlight -composite softlight1.png
Thanks a lot for your help Fred!

With a bit of tweaking I got down to the final command:

Code: Select all

convert \( test.png -alpha set -channel a -evaluate set 60% +channel \) \( test.png -equalize \) -compose softlight -composite output.png
Notes:
Softlight gives a better result than pegtoplight. Pegtoplight is a little too bright and softlight seems a bit more natural.
The 60% opacity is on the original, which is the background layer, not on the equalized layer. This normalizes the colors somehow.

I'm not entirely sure why this method works so well for "auto-leveling", but I spent all of yesterday trying all the different ways to auto-level an image and this seems to give the best overall result when unsupervised.

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

Re: Softlight

Post by fmw42 » 2014-12-08T10:52:40-07:00

this is more efficient, so that you do not read the input twice

Code: Select all

convert text.png \( -clone 0  -alpha set -channel a -evaluate set 60% +channel \) \( -clone 0 -equalize \) \
-delete 0 -compose softlight -composite output.png
But I think it may be better to use the 60% alpha on the equalized image, since it is harsher. That way you can get a result between the input and the equalized value.

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

Re: Softlight

Post by snibgo » 2014-12-09T04:15:22-07:00

alasdairdf wrote:... I spent all of yesterday trying all the different ways to auto-level an image and this seems to give the best overall result when unsupervised.
I've been working on this for two years, on and off: automatically making the "best" image from a raw camera file. For a while, I favoured a 50% blend of the "best gamma" image and an equalisation. Then I favoured a sigmoid curve that yielded a given standard deviation. I'm currently working on contrast-limited equalisation. It's the first totally unsupervised method I've found that often gives me results I prefer to Nikon JPEGs.
snibgo's IM pages: im.snibgo.com

alasdairdf
Posts: 53
Joined: 2012-05-15T04:56:50-07:00
Authentication code: 13

Re: Softlight

Post by alasdairdf » 2014-12-09T04:24:55-07:00

this is more efficient, so that you do not read the input twice
Cools, thanks!
I've been working on this for two years, on and off: automatically making the "best" image from a raw camera file. For a while, I favoured a 50% blend of the "best gamma" image and an equalisation. Then I favoured a sigmoid curve that yielded a given standard deviation. I'm currently working on contrast-limited equalisation. It's the first totally unsupervised method I've found that often gives me results I prefer to Nikon JPEGs.
Interesting... are you willing to share your experience? What do you think of my method?

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

Re: Softlight

Post by snibgo » 2014-12-09T05:05:44-07:00

I've published quite a lot on my "Adding zing to photographs" page, but that doesn't yet have the best-gamma, blend-equalize or contrast-limited equalisation processes. It will, when I get around to it.
snibgo's IM pages: im.snibgo.com

alasdairdf
Posts: 53
Joined: 2012-05-15T04:56:50-07:00
Authentication code: 13

Re: Softlight

Post by alasdairdf » 2014-12-09T05:42:17-07:00

That is some magic. You should patent it and sell it Canon.

Post Reply