Vips.Image.sharpen

### Method

# Vips Imagesharpen

#### Declaration [src]

    int
    vips_sharpen (
      VipsImage* in,
      VipsImage** out,
      ...
    )

#### Description [src]

Selectively sharpen the L channel of a LAB image. The input image is transformed to `VIPS_INTERPRETATION_LABS`.

The operation performs a gaussian blur and subtracts from `in` to generate a high-frequency signal. This signal is passed through a lookup table formed from the five parameters and added back to `in`.

The lookup table is formed like this:

                        ^
                     y2 |- - - - - -----------
                        |         /
                        |        / slope m2
                        |    .../
                -x1     | ...   |
    -------------------...---------------------->
                |   ... |      x1
                |... slope m1
                /       |
               / m2     |
              /         |
             /          |
            /           |
           /            |
    ______/ _ _ _ _ _ _ | -y3
                        |

For screen output, we suggest the following settings (the defaults):

    sigma == 0.5
    x1 == 2
    y2 == 10         (don't brighten by more than 10 L*)
    y3 == 20         (can darken by up to 20 L*)
    m1 == 0          (no sharpening in flat areas)
    m2 == 3          (some sharpening in jaggy areas)

If you want more or less sharpening, we suggest you just change the m2 parameter.

The `sigma` parameter changes the width of the fringe and can be adjusted according to the output printing resolution. As an approximate guideline, use 0.5 for 4 pixels/mm (display resolution), 1.0 for 12 pixels/mm and 1.5 for 16 pixels/mm (300 dpi == 12 pixels/mm). These figures refer to the image raster, not the half-tone resolution.

Optional arguments

- `sigma`: `gdouble`, sigma of gaussian
- `x1`: `gdouble`, flat/jaggy threshold
- `y2`: `gdouble`, maximum amount of brightening
- `y3`: `gdouble`, maximum amount of darkening
- `m1`: `gdouble`, slope for flat areas
- `m2`: `gdouble`, slope for jaggy areas

See also

`vips_conv()`.

This method is not directly available to language bindings.

#### Parameters

`out`

  Type: `VipsImage`

  Output image.

  The argument will be set by the function.
  The caller of the method takes ownership of the returned data, and is responsible for freeing it.

`...`

  Type: ``

  `NULL`-terminated list of optional named arguments.

#### Return value

Type: `int`

0 on success, -1 on error.