Search code examples
imagemagickimagemagick-convert

How ImageMagick "sigmoidal-contrast" can be interpreted?


I could not find any good explanations of sigmoidal-contrast parameter. For example, if we have such a command:

$ convert -channel B -gamma 1.25 -channel G -gamma 1.25 -channel RGB -sigmoidal-contrast 25x25% 564.tif 564-adj.tif

What does this 25x25% mean? What is the right syntax of this parameter? Can we have values like LxMxN%? Are these values - integer numbers only? Thanks!


Solution

  • I think the answer here is going to be quite subjective. As I said in the comments, there is an already excellent explanation by Anthony Thyssen here.

    As far as I understand, there are two parameters which are:

    • the amount of contrast increase, with 0 being least and 10 being most, and
    • the centre-point about which to increase the contrast, which is on a scale of 0-100%, where 50% would increase the contrast centred around mid-grey (i.e. 128 on a scale of 0-255).

      convert input.png -sigmoidal-contrast <AMOUNT>,<CENTRE>% result.png

    Let's look at the <CENTRE> value first. In general, you would want to draw a line of increasing contrast through the range of pixel brightnesses that interests you. The histogram is the easiest way I know of to determine where that is. So, if your histogram looks like this:

    enter image description here

    then I would suggest you use something like 25% for the <CENTRE> value. Whereas if your histogram looks more like this:

    enter image description here

    then you would probably want to set the <CENTRE> to 75%. So, in general, 50% is not an unreasonable default for the <CENTRE> parameter.

    The <AMOUNT> parameter is going to be very subjective and vary from photo to photo. If, as I suspect, you are analysing satellite imagery, you can probably experiment to find a sensible value and then bulk-apply it to your images from the same series. I would start with 3-5 for normal photos maybe.