Example of "Levels adjust" tool. In this example, the tool is used to fix a dark photo.This tutorial is based on http://userbase.kde.org/Showfoto/Levels_Adjust.
Thus, it is dual licensed under the GNU Free Documentation License 1.2 (http://www.gnu.org/licenses/fdl.txt) and the Creative Commons Attribution-ShareAlike License (http://creativecommons.org/licenses/by-sa/3.0/).<para><emphasis>Levels adjust</emphasis> is a tool to adjust the luminosity and/or colors of an image by changing the range of values of each component and applying gamma correction.</para>
<para><emphasis>Great! Wait... What does that mean?</emphasis> Well, that means that you can use that tool, for example, to fix a dark photo. And that is what we will do here.</para>
<para>First of all, we will open the example photo to fix (<interface>File|Open</interface>).</para>In the <link url="widget:File Location UrlComboBox">name of the image to open</link>, copy or write this filename:<nl/>
<filename>http://userbase.kde.org/images.userbase/8/89/Levels_adjust.JPG</filename>urlComboBox = ktutorial.findObject("File Location UrlComboBox");
urlComboBox.clearEditText();
urlComboBox.setEditText("http://userbase.kde.org/images.userbase/8/89/Levels_adjust.JPG");Now click the <interface>Open</interface> button to open the image (it will be downloaded from Internet, so you need a working Internet conection).To see why the image is dark, open the <link url="widget:Color Tab Button">color panel</link>.Set the histogram scale to <link url="widget:Linear Histogram Button">linear</link>, as it shows more clearly why the image is dark.We are interested in the luminosity of the image, so select <emphasis>Luminosity</emphasis> in the <link url="widget:Histogram Channel Combo Box">channel combo box</link>.<para>On the <link url="widget:Color Tab Button">color tab</link>, you can see the <link url="widget:Histogram">image's histogram</link>. So <emphasis>"What's the histogram?"</emphasis>, you'll ask. The histogram is just a pixel count. It counts how many pixels there are for each gray level (when the <link url="widget:Histogram Channel Combo Box">luminosity channel</link> is selected), and shows them in a graph. The <link url="widget:Linear Histogram Button">linear scale</link> is better to see it. The left part of the histogram are dark/black colors, and the right part of the histogram are brightest colors.</para>
<para>You can see that our image has the histogram concentrated on the left part. Thus, it's mostly black. The right part of the histogram isn't used at all. Why did this happen? Just because the camera failed exposing the image properly, or was inappropriately configured.</para>
<para>If a photo is visually pleasing, usually (not always), it covers most of the histogram, from black, to white.</para>
<para>So, is there a way to fix this, then? Of course there is, and it's a very easy one. Select the menu <interface>Color|Levels Adjust</interface></para>The <emphasis>Levels Adjust</emphasis> tool remembers the values of its parameters between uses. To be sure that no parameter has a value from a previous use, push the <link url="widget:Default Values Button">default values button</link>.Note that the preview mode is set to <link url="widget:Preview Original Button">original</link>, so when you change some parameter in the tool no preview would be shown. Select any of the other preview modes to avoid this.To see the histogram more clearly, set the <link url="widget:Adjust Levels Settings Widget/Linear Histogram Button">linear scale</link>.We want to fix the luminosity of the image, so select <emphasis>Luminosity</emphasis> in the <link url="widget:Adjust Levels Settings Widget/Histogram Channel Combo Box">channel combo box</link> of the tool.<para>The <emphasis>Levels adjust</emphasis> tool contains two histograms: the first one is the <emphasis>output/new</emphasis> histogram, and the second (bottom) one is the <emphasis>input/original</emphasis> histogram.</para>
<para>What you have to do is adjust the output histogram to cover it all. How is it done?</para>
<para>There are two sliders in this tool. The <link url="widget:Input Intensity Slider">first slider</link> marks the beginning and end of the part of the histogram that we are interested in. You should move it to match the full histogram of our original image, so set the maximal input intensity to around 134.</para>
<para>The <link url="widget:Output Intensity Slider">other slider</link> marks the range of the histogram we want as output. We want the histogram to cover from black to white, so just leave it as it is, from 0 to 255.</para><para>Setting the maximal input intensity to around 134 and leaving the minimal input intensity to 0, the minimal output intensity to 0, and the maximal output intensity to 255 gaves a good result in our example image.</para>
<para>However, the right value for each parameter will depend on the image we want to fix. We can do it manually like now, modifying the values to adjust the output histogram to cover it all. But we can also let the tool do it by itself.</para>
<para>How? Just click the <link url="widget:Auto Adjust Levels Button">auto adjust button</link>.</para><para>Unlike us, that we only modified the luminosity, the auto adjust works in each of the color channels (red, green and blue). Anyway, looking at the preview you can see that it pretty much knows what it is doing ;)</para>
<para>Now, to apply the changes to the image, just <link url="widget:Ok Button">accept</link> them.</para><para>And that's all folks. Our nice example photo is fixed :)</para>
<para>Just a little note. As the photo was modified, opening another image or quitting the application would prompt you about saving the changes. Say no; remember that, as this is an example, the photo was downloaded from Internet, and you just can not modify that example file ;)</para>