# enhance.c File Reference

`#include "magick/studio.h"`
`#include "magick/cache-view.h"`
`#include "magick/color.h"`
`#include "magick/color-private.h"`
`#include "magick/colorspace.h"`
`#include "magick/enhance.h"`
`#include "magick/exception.h"`
`#include "magick/exception-private.h"`
`#include "magick/gem.h"`
`#include "magick/geometry.h"`
`#include "magick/image.h"`
`#include "magick/image-private.h"`
`#include "magick/memory_.h"`
`#include "magick/monitor.h"`
`#include "magick/quantum.h"`
`#include "magick/quantum-private.h"`
`#include "magick/resample.h"`
`#include "magick/string_.h"`

## Defines
#define | ClutImageTag "Clut/Image"
#define | DullContrastImageTag "DullContrast/Image"
#define | SharpenContrastImageTag "SharpenContrast/Image"
#define | MaxRange(color) ((MagickRealType) ScaleQuantumToMap((Quantum) (color)))
#define | NormalizeImageTag "Normalize/Image"
#define | Enhance(weight)
#define | EnhanceImageTag "Enhance/Image"
#define | EqualizeImageTag "Equalize/Image"
#define | GammaCorrectImageTag "GammaCorrect/Image"
#define | LevelImageTag "Level/Image"
#define | LinearStretchImageTag "LinearStretch/Image"
#define | ModulateImageTag "Modulate/Image"
#define | NegateImageTag "Negate/Image"
#define | SigmoidalContrastImageTag "SigmoidalContrast/Image"
## Functions
MagickExport MagickBooleanType | ClutImage (Image *image, const Image *clut_image)
MagickExport MagickBooleanType | ClutImageChannel (Image *image, const ChannelType channel, const Image *clut_image)
static void | Contrast (const int sign, Quantum *red, Quantum *green, Quantum *blue)
MagickExport MagickBooleanType | ContrastImage (Image *image, const MagickBooleanType sharpen)
MagickExport MagickBooleanType | ContrastStretchImage (Image *image, const char *levels)
MagickExport MagickBooleanType | ContrastStretchImageChannel (Image *image, const ChannelType channel, const double black_point, const double white_point)
MagickExport Image * | EnhanceImage (const Image *image, ExceptionInfo *exception)
MagickExport MagickBooleanType | EqualizeImage (Image *image)
MagickExport MagickBooleanType | EqualizeImageChannel (Image *image, const ChannelType channel)
MagickExport MagickBooleanType | GammaImage (Image *image, const char *level)
MagickExport MagickBooleanType | GammaImageChannel (Image *image, const ChannelType channel, const double gamma)
MagickExport MagickBooleanType | LevelImage (Image *image, const char *levels)
MagickExport MagickBooleanType | LevelImageChannel (Image *image, const ChannelType channel, const double black_point, const double white_point, const double gamma)
MagickExport MagickBooleanType | LinearStretchImage (Image *image, const double black_point, const double white_point)
static void | ModulateHSB (const double percent_hue, const double percent_saturation, const double percent_brightness, Quantum *red, Quantum *green, Quantum *blue)
static void | ModulateHSL (const double percent_hue, const double percent_saturation, const double percent_luminosity, Quantum *red, Quantum *green, Quantum *blue)
static void | ModulateHWB (const double percent_hue, const double percent_whiteness, const double percent_blackness, Quantum *red, Quantum *green, Quantum *blue)
MagickExport MagickBooleanType | ModulateImage (Image *image, const char *modulate)
MagickExport MagickBooleanType | NegateImage (Image *image, const MagickBooleanType grayscale)
MagickExport MagickBooleanType | NegateImageChannel (Image *image, const ChannelType channel, const MagickBooleanType grayscale)
MagickExport MagickBooleanType | NormalizeImage (Image *image)
MagickExport MagickBooleanType | NormalizeImageChannel (Image *image, const ChannelType channel)
MagickExport MagickBooleanType | SigmoidalContrastImage (Image *image, const MagickBooleanType sharpen, const char *levels)
MagickExport MagickBooleanType | SigmoidalContrastImageChannel (Image *image, const ChannelType channel, const MagickBooleanType sharpen, const double contrast, const double midpoint)

## Define Documentation

#define ClutImageTag "Clut/Image"

#define DullContrastImageTag "DullContrast/Image"

#define Enhance | ( | weight |  | ) |

Value:

    mean=((MagickRealType) r->red+pixel.red)/2; \
      distance=(MagickRealType) r->red-(MagickRealType) pixel.red; \
      distance_squared=QuantumScale*(2.0*((MagickRealType) QuantumRange+1.0)+ \
         mean)*distance*distance; \
      mean=((MagickRealType) r->green+pixel.green)/2; \
      distance=(MagickRealType) r->green-(MagickRealType) pixel.green; \
      distance_squared+=4.0*distance*distance; \
      mean=((MagickRealType) r->blue+pixel.blue)/2; \
      distance=(MagickRealType) r->blue-(MagickRealType) pixel.blue; \
      distance_squared+=QuantumScale*(3.0*((MagickRealType) \
        QuantumRange+1.0)-1.0-mean)*distance*distance; \
      mean=((MagickRealType) r->opacity+pixel.opacity)/2; \
      distance=(MagickRealType) r->opacity-(MagickRealType) pixel.opacity; \
      distance_squared+=QuantumScale*(3.0*((MagickRealType) \
        QuantumRange+1.0)-1.0-mean)*distance*distance; \
      if (distance_squared < ((MagickRealType) QuantumRange*(MagickRealType) \
          QuantumRange/25.0f)) \
        { \
          aggregate.red+=(weight)*r->red; \
          aggregate.green+=(weight)*r->green; \
          aggregate.blue+=(weight)*r->blue; \
          aggregate.opacity+=(weight)*r->opacity; \
          total_weight+=(weight); \
        } \
      r++;

#define EnhanceImageTag "Enhance/Image"

#define EqualizeImageTag "Equalize/Image"

#define GammaCorrectImageTag "GammaCorrect/Image"

#define LevelImageTag "Level/Image"

#define LinearStretchImageTag "LinearStretch/Image"

#define MaxRange | ( | color |  | ) | ((MagickRealType) ScaleQuantumToMap((Quantum) (color)))

#define ModulateImageTag "Modulate/Image"

#define NegateImageTag "Negate/Image"

#define NormalizeImageTag "Normalize/Image"

#define SharpenContrastImageTag "SharpenContrast/Image"

#define SigmoidalContrastImageTag "SigmoidalContrast/Image"

## Function Documentation

MagickExport MagickBooleanType ClutImage | ( | Image * | image,
|  | const Image * | clut_image |
| ) |  |  |

MagickExport MagickBooleanType ClutImageChannel | ( | Image * | image,
|  | const ChannelType | channel,
|  | const Image * | clut_image |
| ) |  |  |

static void Contrast | ( | const int | sign,
|  | Quantum * | red,
|  | Quantum * | green,
|  | Quantum * | blue |
| ) |  |  | `[static]`

MagickExport MagickBooleanType ContrastImage | ( | Image * | image,
|  | const MagickBooleanType | sharpen |
| ) |  |  |

MagickExport MagickBooleanType ContrastStretchImage | ( | Image * | image,
|  | const char * | levels |
| ) |  |  |

MagickExport MagickBooleanType ContrastStretchImageChannel | ( | Image * | image,
|  | const ChannelType | channel,
|  | const double | black_point,
|  | const double | white_point |
| ) |  |  |

MagickExport Image* EnhanceImage | ( | const Image * | image,
|  | ExceptionInfo * | exception |
| ) |  |  |

MagickExport MagickBooleanType EqualizeImage | ( | Image * | image | ) |

MagickExport MagickBooleanType EqualizeImageChannel | ( | Image * | image,
|  | const ChannelType | channel |
| ) |  |  |

MagickExport MagickBooleanType GammaImage | ( | Image * | image,
|  | const char * | level |
| ) |  |  |

MagickExport MagickBooleanType GammaImageChannel | ( | Image * | image,
|  | const ChannelType | channel,
|  | const double | gamma |
| ) |  |  |

MagickExport MagickBooleanType LevelImage | ( | Image * | image,
|  | const char * | levels |
| ) |  |  |

MagickExport MagickBooleanType LevelImageChannel | ( | Image * | image,
|  | const ChannelType | channel,
|  | const double | black_point,
|  | const double | white_point,
|  | const double | gamma |
| ) |  |  |

MagickExport MagickBooleanType LinearStretchImage | ( | Image * | image,
|  | const double | black_point,
|  | const double | white_point |
| ) |  |  |

static void ModulateHSB | ( | const double | percent_hue,
|  | const double | percent_saturation,
|  | const double | percent_brightness,
|  | Quantum * | red,
|  | Quantum * | green,
|  | Quantum * | blue |
| ) |  |  | `[static]`

static void ModulateHSL | ( | const double | percent_hue,
|  | const double | percent_saturation,
|  | const double | percent_luminosity,
|  | Quantum * | red,
|  | Quantum * | green,
|  | Quantum * | blue |
| ) |  |  | `[static]`

static void ModulateHWB | ( | const double | percent_hue,
|  | const double | percent_whiteness,
|  | const double | percent_blackness,
|  | Quantum * | red,
|  | Quantum * | green,
|  | Quantum * | blue |
| ) |  |  | `[static]`

MagickExport MagickBooleanType ModulateImage | ( | Image * | image,
|  | const char * | modulate |
| ) |  |  |

MagickExport MagickBooleanType NegateImage | ( | Image * | image,
|  | const MagickBooleanType | grayscale |
| ) |  |  |

MagickExport MagickBooleanType NegateImageChannel | ( | Image * | image,
|  | const ChannelType | channel,
|  | const MagickBooleanType | grayscale |
| ) |  |  |

MagickExport MagickBooleanType NormalizeImage | ( | Image * | image | ) |

MagickExport MagickBooleanType NormalizeImageChannel | ( | Image * | image,
|  | const ChannelType | channel |
| ) |  |  |

MagickExport MagickBooleanType SigmoidalContrastImage | ( | Image * | image,
|  | const MagickBooleanType | sharpen,
|  | const char * | levels |
| ) |  |  |

MagickExport MagickBooleanType SigmoidalContrastImageChannel | ( | Image * | image,
|  | const ChannelType | channel,
|  | const MagickBooleanType | sharpen,
|  | const double | contrast,
|  | const double | midpoint |
| ) |  |  |