Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 34 additions & 33 deletions reference/imagick/imagick/sigmoidalcontrastimage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,21 @@
<methodparam><type>float</type><parameter>beta</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>channel</parameter><initializer>Imagick::CHANNEL_DEFAULT</initializer></methodparam>
</methodsynopsis>
<para>
<simpara>
Adjusts the contrast of an image with a non-linear sigmoidal contrast
algorithm. Increase the contrast of the image using a sigmoidal transfer
function without saturating highlights or shadows. Contrast indicates
how much to increase the contrast (0 is none; 3 is typical; 20 is
pushing it); mid-point indicates where midtones fall in the resultant
image (0 is white; 50 is middle-gray; 100 is black). Set sharpen to
function without saturating highlights or shadows. <parameter>alpha</parameter> indicates
how much to increase the contrast: <literal>0.00</literal> is none; <literal>3.00</literal> is
typical; <literal>20.00</literal> is pushing it.
<parameter>beta</parameter> indicates where midtones fall in the resultant
image: <literal>0.00</literal> is white; <literal>0.50</literal> is
middle-gray; <literal>1.00</literal> is black. Set <parameter>sharpen</parameter> to
Comment on lines +25 to +26

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think dividing by 100 is correct here. I don't know anything about Imagick, so I think keeping it 0, 50, 100 is safer.

&true; to increase the image contrast otherwise the contrast is reduced.
</para>
<para>
</simpara>
<simpara>
See also <link xlink:href="&url.imagemagick.usage.color_mods.sigmoidal;">ImageMagick
v6 Examples - Image Transformations — Sigmoidal Non-linearity Contrast</link>
</para>
Examples -- Color Modifications — Sigmoidal Non-linearity Contrast</link>.
</simpara>
</refsect1>

<refsect1 role="parameters">
Expand All @@ -37,33 +39,35 @@
<varlistentry>
<term><parameter>sharpen</parameter></term>
<listitem>
<para>
If true increase the contrast, if false decrease the contrast.
</para>
<simpara>
If &true; increase the contrast, if &false; decrease the contrast.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>alpha</parameter></term>
<listitem>
<para>
The amount of contrast to apply. 1 is very little, 5 is a significant amount, 20 is extreme.
</para>
<simpara>
The amount of contrast to apply. <literal>1.00</literal> is very little, <literal>5.00</literal>
is a significant amount, <literal>20.00</literal> is extreme.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>beta</parameter></term>
<listitem>
<simpara>
Where the midpoint of the gradient will be. This value should be in the range 0 to 1 - multiplied by the quantum value for ImageMagick.
Where the midpoint of the gradient will be. This value should be in the range <literal>0.00</literal>
to <literal>1.00</literal> - multiplied by the quantum value for ImageMagick.
Comment on lines +60 to +61

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still super confusing to me, but I have no idea how to write it better.

</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>channel</parameter></term>
<listitem>
<para>
<simpara>
Which color channels the contrast will be applied to.
</para>
</simpara>
</listitem>
</varlistentry>
</variablelist>
Expand All @@ -86,31 +90,28 @@

<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>
Create a gradient image using <function>Imagick::sigmoidalContrastImage</function>
suitable for blending two images together smoothly, with the blending
defined by $contrast and $the midpoint
</title>
<programlisting role="php">
<example>
<title>
Create a gradient image using <function>Imagick::sigmoidalContrastImage</function>
suitable for blending two images together smoothly, with the blending
defined by <parameter>alpha</parameter> and <parameter>beta</parameter>
</title>
<programlisting role="php">
<![CDATA[
<?php

function generateBlendImage($width, $height, $contrast = 10, $midpoint = 0.5) {
function generateBlendImage($width, $height, $alpha = 10, $beta = 0.5)
{
$imagick = new Imagick();
$imagick->newPseudoImage($width, $height, 'gradient:black-white');
$quanta = $imagick->getQuantumRange();
$imagick->sigmoidalContrastImage(true, $contrast, $midpoint * $quanta["quantumRangeLong"]);
$imagick->sigmoidalContrastImage(true, $alpha, $beta * $quanta["quantumRangeLong"]);

return $imagick;
}

?>
]]>
</programlisting>
</example>
</para>
</programlisting>
</example>
</refsect1>

</refentry>
Expand Down