Processing and editing images in Lab mode

Many tools are available these days for image editing. In addition to common applications, such as GIMP, several tools exist for specific image processing scenarios. One of them is Photivo [1], which is based on the Lab function (see the "Lab Color Model" box). Because Photivo can read RAW files, its use normally precedes image processing (e.g., what you'd do with GIMP).

Lab Color Model

The Lab abstract color model has been around for 40 years as a way of defining colors independently of display devices and capturing the essence of human color perception. It presents colors so that equally perceived differences are described as similarly as possible. Lab also accounts for all theoretically possible colors, not only those perceivable by the human eye.

The "L" in Lab stands for luminance, the "a" is for the color components between red and green, and the "b" is for those between blue and yellow. Interestingly, this color models defines all the colors in the RGB and CMYK spectrum – and a whole lot more.

The special features of the Lab system lead to measures of brightness being totally independent of color components in the a and b channels. This provides a number of advantages over other color models. The independence of the b channel can be put to good use: For example, it helps in distinguishing the often problematic green tones of leaves without affecting any other color.

Photivo has many RGB functions and is suitable for processing 16-bit RAW files and bases all its capabilities on them. The program also supports formats like TIFF, PNG, and JPEG. If you've never worked with the Lab color model, then you should familiarize yourself with GIMP to start with.

First Steps

Photivo can be found in the repository of many Linux distributions, but with Ubuntu, you will have to add a specific ppa:

sudo add-apt-repository ppa:dhor/myway
sudo apt-get update

Then, you can install as normal.

To make sure Photivo works without a hitch, you may also have to upgrade GraphicsMagick :

sudo apt-get update graphicsmagick

Once installed, the program opens with a large, two-part window (Figure 1). On the right is the preview, and on the left are the tools and parameters.

Figure 1: Photivo's main window consists of a large preview window and a comprehensive tool list. The tools provide context menus for the most commonly used tasks.

Photivo also provides a variety of controls at various points. Below the histogram, you can set which tools you want handy. Below the tool list, you can specify the image size for the preview pane. The default is 1:4, which is usually a good compromise between accuracy and computation time. The manual setting next to it determines whether to change the preview automatically or explicitly by the user. You can set exactly what the preview shows with the RGB tab, where you can select the Structure (distribution of detail), the Gradient (luminance representing edges), or the individual Lab channels.

The next three buttons allow loading of templates, saving current views, and exporting images to a predefined image processor. The lower part of the main view serves as status bar and provides other control elements. When Photivo is processing an image, it shows the image in the preview window (Figure 2). You can set various controls by mouse click, mouse wheel, or held left mouse button. A right-click resets things to their default values.

Figure 2: Photivo performs most actions directly. Various messages show the current condition in the preview window.

Workflow

Photivo differs from many RAW converters in that the functions in the Camera tab under Input only load one image at a time. You can then open an already existing editing profile, which can be a preset (via Open preset ) or one that you set yourself (via Open settings file ).

The first step is to define under Camera color space how Photivo interprets the image. Select an External profile that fits your camera, then set the Target of the profile [2]. As a whole, Photivo builds a workflow from the series of tabs defined.

Choosing the right profile here determines the desired results. For pure monitor display, sRGB would be most appropriate. BT-709 is fitting for HDTV videos; use Pure 2.2 with a standard gamma of 2.2 for all other output. The other settings on this tab are similar to other RAW converters, such as Darktable. However, Photivo has tools on other tabs that are closer to other image editing tools like GIMP.

The next tab is for Local Edit . The idea behind this is that not all image regions need to have the same editing treatment to optimize the results. Thus, it makes no sense to make "lights" (bright regions) even brighter, but perhaps shadows should be lightened.

The functions require a certain routine approach. Beginners should stick to editing functions that already have many separate edits for lights, mid-tones, and shadows.

Image processors like GIMP use selections, masks, and so forth for separate editing. In Photivo, rather, you define one or more image regions to work on with Local adjust . To determine regions, first click + and select Assign regions . Then, click the a spot on the image – the sky or shadows, for example – that particularly represents the region, which is like using the magic wand in GIMP to encompass an image area with similar colors and brightness.

Photivo creates a new "region" that adopts this name by default. You can have any number of regions, which you should give appropriate identifiers for a better overview. In the preview window, the current "mask" marks this region with a bright, cloud-like texture (Figure 3). The mask doesn't need to be too exact, because you can always adjust it later.

Figure 3: Photivo allows you to mark certain image regions for separate editing. The preview shows a "cloud" for the currently selected region.

Photivo provides three controls for Masks , along with a short help text if you hover your mouse over them. The luminance curve can also greatly affect the result. After defining the regions, you select the ones you want and remove the ones you don't want. Clicking the check box ends region definition mode and returns to the editing functions [3].

Geometry

The functions combined in the Geometry tab are like those for RAW converters. The five lens-related settings (Lens Parameters through Geometry Conversion ), and in a limited way also Defish , use the LensFun database [4]. These settings characterize lenses by specific parameters to correct distortion, vignetting, and color fringing. The Exif tags for the lens properties written into the image are thus combined with the parameters stored in the database.

Geometry Conversion can clean up the typical pillow-shape, barrel-shape, and other distortions. This tool provides good results in particular for architectural photos, but in other cases as well. If a parameter is unknown , no conversion takes place. Apply the LensFun-based filters in the order of the tabs for the best results.

Even Rotation is similar to many RAW converters. You can rotate images in 90-degree increments losslessly or at any angle. If you select a horizontal or vertical line, Photivo correspondingly corrects the image automatically. Cropping is done with the same tool. As in GIMP, you select a region and confirm it by double-clicking. Again, you have the option of optimally positioning the cutout with help from guide lines.

Content-aware resizing, known as Seam carving , is among the least known of the tools. It allows you to rescale and change the aspect ratio horizontally or vertically of your image while preserving important features.

GIMP has a corresponding "Liquid Rescale" function that is considerably more powerful. The filter uses relatively little processing effort in that it's limited to predefined image regions (Figure 4).

Figure 4: The result of content-aware resizing depends on the parameters (Energy method) used.

Many of the RGB functions are also known to common image editors and RAW converters. Some of the lesser known functions are nonetheless interesting: Reinhard brightening provides an effective method of correcting darker image regions without making broad changes to surrounding ones.

Sigmoidal contrast lays out an S-shaped curve whose course controls contrast in a way corresponding to normal viewing habits. Partial exposure recovery allows modification of light, shadow, and mid-tones independently. Both Black and white conversion and the RGB curve tool control the global brightness of an image.

The Block setting deactivates the computationally intensive tools in the other tabs so that you can quickly test the effect of a basic function. Functions under Camera , Geometry , and Output meanwhile always remain active.

Lab

Much more exciting than the RGB-based tools are the ones that apply to Lab mode (Table 1). Photivo collects these tools under the following three tabs: Lab Color and Contrast , Lab Sharpen and Noise , and Lab Eyecandy .

Table 1

Photivo – Tool Groups

Camera Loading images, basic settings
Local Edit Correcting specify parts of the image
Geometry Rotating, cropping and scaling images
RGB Various modifications of the RGB color space
Lab Color and Contrast Local contrast and dynamic compression
Lab Sharpen and Noise Sharpening and denoising
Lab Eyecandy Various effects, often for different brightnesses (shadows, mids, and lights)
Eyecandy Various effects in the RGB color space
Output Options for saving images

You first determine with Lab transformation how Photivo is to create the L channel. By default, it follows a well-known formula [5] for transformation from the XYZ color space. Photivo also provides other variations.

The functions in the first tab are like the ones in RGB ; they perform the same tasks but work differently. Thus, Shadows/Lights allows settings depending on detail size, which can lead to almost HDR effects, such as the luminance [7] that the Mantiuk 06 operator creates.

The Lab Color and Contrast also provides various sharpening and denoising filters. You can easily compare the effects. The preset and impressively fast Wiener filter brings sharpness to the image by largely removing the random noise. However, many very bright images with strong contrast might better require the Edges only option to minimize artifacts.

The Lab Eyecandy tab provides functions, on the one hand, to tone images after the fact, such as Tone curves or Adaptive saturation . On the other hand, the Edge avoiding wavelets filter can compensate for vignetting. Value lets you enter positive values – that create a vignette – or negative values that compensate for them. You can make exact modifications with parameters such as Softness , Inner radius , and Roundness .

Lab Eyecandy also includes the especially important color curves for L*, a*, and b*. The L* curve functions like the Value channel in GIMP's curve tool but allows for only a single control point by default. You can add more with a right mouse click.

This feature allows you to apply the much more exciting a* and b* curves, which control the red/green and yellow/blue color distributions, respectively, in the image. Application requires some careful finger work. Often, all the curves are shifted vertically or horizontally (Figure 5).

Figure 5: Color corrections with the a* and b* curves are tricky. The integrated color patterns help move the curve in the right direction.

Moving the middle control point often creates decolorization where it should normally remain unchanged. Lab Eyecandy contains the most important Photivo functions and requires the most time to master. The Eyecandy tab also provides toning functions, this time based on RGB. Here, you'll find Cross processing , which can produce subtle as well as spectacular color effects.

Another variation of Edge avoiding wavelets is there together with functions for Smoothing and Softglow/Orton , which produces a magical glow. In some situations, Color intensity can produce good results, such as enhancing water sparkling.

Output

In the last tab, Output , you can set how Photivo is to send the image. Most entries are self-explanatory. RGB curve corresponds to the normal value curves and interferes with the L* curve . The sRBG gamma compensation output has relatively large effects that you don't necessarily need to activate.

The selected Output color space determines how Photivo converts the image files into output files. The five versions sRBG , sRGBlinear , ProPhotoRGBlinear , AdobeRGBlinear , and WideGamutRGBlinear differentiate themselves mainly by the amount of colors they produce. Wide-gamut RGB encompasses a good three-fourths of all the Lab-defined colors, sRGB only about a third, and Adobe-RGB just about half [8]. Wide-gamut color spaces make sense only with 16-bit input and output data. Adobe-RGB is mainly used for printing because of its better green tones.

Among the Output settings Photivo provides 16-bit versions of the usual 8-bit PNG and TIFF formats, as well as PPM. Only these formats ensure maximum output quality, albeit at the expense of much higher file sizes.

Conclusion

With Photivo, you get a powerful tool for enhancing (RAW) images, but you certainly won't want to do this without some experimentation first. The program fills the gap between purely RAW converters and classic image processors. Corrections to RAW images are best made before the actual image editing, where the high processing speed proves advantageous.

The only thing missing that Photivo developers could consider integrating is the Luminance-HDR code.