ImageGear .NET v25.2 - Updated
Developer Guide / How to Work with... / Image Processing and Cleanup / Use Processing Methods
In This Topic
    Use Processing Methods
    In This Topic

    The classes ImGearProcessing Class, ImGearRasterProcessing Class, and ImGearEffects Class present a set of methods for modifying an image. You do not need to create an ImGearProcessing Class object to call its methods since all methods are static. Any method takes an image to be processed and some additional parameters necessary for processing the operation. For example, the Rotate Method will be called as follows:

    ImGearProcessing.Rotate(Page, ImGearRotationValues.VALUE_90);

    Image processing methods are shown below: 

    Action Group API Reference
    Crop - removes part of the image ImGearProcessing.Crop Method
    Resize - retains the same image, but either increase the number of pixels (interpolating to determine the color values for the new ones), or reduce the number of pixels ImGearProcessing.Resize Method
    Changes the geometry of the image ImGearProcessing.Flip Method
    ImGearProcessing.Rotate Method
    ImGearEffects.Shear Method
    ImGearEffects.Perspective Method
    Changes the contrast, brightness and/or gamma correction in the image - all these methods have two representations: the second type takes two additional parameters Contrast Mode and Channel Range; the first representation of any method calculates these parameters according the image type and color space. ImGearRasterProcessing.InvertContrast Method
    ImGearRasterProcessing.AdjustContrast Method
    ImGearRasterProcessing.StretchContrast Method
    ImGearRasterProcessing.EqualizeContrast Method
    Creating a thumbnail - an image with the new size is created but source image is not changed ImGearProcessing.CreateThumbnail Method
    Checking for grayscale image ImGearRasterProcessing.ImageIsGray Method
    Filter methods - these methods are based on the convolution of the image and the filter matrix. Any filter method (except Convolution) has two representations: with and without channel range. ImGearRasterProcessing.Convolve Method
    ImGearRasterProcessing.Sharpen Method
    ImGearRasterProcessing.Smooth Method
    ImGearRasterProcessing.FilterWithMedian Method
    ImGearRasterProcessing.FilterWithUnsharpMask Method
    Methods for combining two or more images - these methods have two representation: with and without channel range ImGearRasterProcessing.Merge Method
    ImGearRasterProcessing.Blend Method
    ImGearRasterProcessing.BlendWithAlpha Method
    Methods for manipulating with image channels and color spaces ImGearRasterProcessing.ConvertColorSpace Method
    ImGearRasterProcessing.ChangeChannelDepths Method
    ImGearRasterProcessing.CombineChannels Method
    ImGearRasterProcessing.SeparateChannels Method
    ImGearRasterProcessing.InsertChannel Method
    ImGearRasterProcessing.RemoveChannel Method
    ImGearRasterProcessing.CreateChannelCopy Method
    ImGearRasterProcessing.UpdateChannelFrom Method
    ImGearRasterProcessing.SwapChannels Method
    Processing binary and grayscale images by applying erosion and dilation ImGearRasterProcessing.Dilate Method
    ImGearRasterProcessing.Erode Method
    ImGearRasterProcessing.Close Method
    ImGearRasterProcessing.Open Method
    Stylization - these methods imitate scanned paper photographs, analog cameras, or special photo equipment ImGearEffects.Aging Method
    ImGearEffects.NightVision Method
    ImGearEffects.ToyCamera Method
    Artistic effects - these methods make the image look like a hand painted picture ImGearEffects.Oilify Method
    ImGearEffects.Pointillist Method
    ImGearEffects.Spatter Method
    Rendering effects - these methods change image lightness or color using a specific shaper or pattern ImGearEffects.DirectionalLight Method
    ImGearEffects.FreeDirectionalLight Method
    ImGearEffects.FreeRadialLight Method
    ImGearEffects.LensFlare Method
    ImGearEffects.RadialLight Method
    ImGearEffects.Spotlights Method
    ImGearEffects.SpotlightsPreview Method
    Image enhancement - these methods enhance image detail ImGearRasterProcessing.EnhanceLocal Method
    Borders and frames - these methods add borders, frames, or vignettes to the image ImGearEffects.DropShadow Method
    ImGearEffects.RoundCorners Method
    ImGearEffects.Vignette Method
    Distortions - these methods rearrange pixels using a specific pattern or texture ImGearEffects.Fragment Method
    ImGearEffects.Mosaic Method
    ImGearEffects.Pinch Method
    ImGearEffects.RadialWave Method
    ImGearEffects.WarpCylinder Method
    ImGearEffects.WarpParabolic Method
    ImGearEffects.WarpSphere Method
    Color effects - these methods give the image a new look by changing its color ImGearEffects.Duotone Method
    ImGearEffects.Sepia Method
    ImGearEffects.Spotlights Method
    ImGearEffects.SpotlightsPreview Method
    ImGearEffects.Solarize Method
    Removes red eye ImGearPixelCheckerRedEyeRGB.ImGearPixelCheckerRedEyeRGB Constructor
    ImGearPixelProcessorRedEyeRGB.ImGearPixelProcessorRedEyeRGB Constructor
    Detects image edges ImGearEffects.EdgeDetection Method
    Speckle removal - these methods remove noise from a grayscale or bitonal image ImGearRasterProcessing.Despeckle Method
    ImGearRasterProcessing.GeomDespeckle Method

    The C# samples given below illustrate how to work with some Image Processing methods (in the samples, assume that igPage is a valid object of type ImGearPage Class):

    Rotate

    C#
    Copy Code
    // Rotate the page to 45 degrees and expand according to the new image
    // size. The background will be set to black.
    // Create background color object
    ImGearPixel igPixelBackground = new ImGearPixel(igPage.DIB.ChannelCount,
        igPage.DIB.BitsPerChannel);
    // Rotate
    ImGearProcessing.Rotate(igPage, 45, ImGearRotationModes.EXPAND, igPixelBackground);
    

    Crop

    C#
    Copy Code
    // Cut a quarter of an image from left, top, right and bottom
    int cutWidth = igPage.DIB.Width / 4;
    int cutHeight = igPage.DIB.Height / 4;
    // Crop
    ImGearProcessing.Crop(igPage, cutWidth, cutHeight, 2 * cutWidth, 2 * cutHeight);
    

    AdjustContrast

    C#
    Copy Code
    double contrast = 1.2;
    double brightness = 64;
    double gamma = 1.5;
    ImGearRasterProcessing.AdjustContrast((ImGearRasterPage)igPage, contrast, brightness, gamma);
    
    See Also