This method uses a specified color (RGB value), compares this value to pixels in the image and selects areas of the image that have that color. From this selection, This method creates a new image and mask image.

[Visual Basic]
Public Function AutoSelectImage(red As Byte, green As Byte, blue As Byte, mode As Integer, level As Integer) As Boolean
[C#]
public bool AutoSelectImage(byte red, byte green, byte blue, int mode, int level);

Parameters

red
     Specifies the red value of the color that will be selected (From 0 to 255)

green
     Specifies the green value of the color that will be selected (From 0 to 255)

blue
     Specifies the blue value of the color that will be selected (From 0 to 255)

mode
     Comparison mode (0:RGB, 1:CrCb, 2:Y)

level
     Level of Allowance (From 0 to 255)

Return Value

Returns True if successful. Returns False if unsuccessful.

Explanation

The AutoSelectImage method uses a specified color (RGB value), and selects areas of the image that have that color. To execute the AutoSelectImage method, set the image handle of the image in the SourceImage property. The AutoSelectImage method supports 1, 4, 8, 16, 24, and 32 bit images.

The Mode parameter sets the type of color comparison used to select portions of the image. When the Mode parameter is other than 0 (i.e. CrCb or Y) then all RGB values are converted to YCrCb values and compared. The Level parameter controls the range of RGB values that will be selected. If the Level value is 0, then only those pixels that have the save RGB value as that specified in the Red, Green, and Blue parameters will be selected.

As the Level parameter increases, the range of RGB values that will be selected increases. For example, if Level = 10 and Red, Green, and Blue = 100 respectively, then all pixels with an RGB value between (90,90,90) and (110,110,110) will be selected.

Before executing the AutoSelectImage method, you must set the area on the image that will be affected. There are 4 ways to do this.

  1. To process the total image, set the SelectMode property to EffectAll
  2. To process the polygonal area on the image, set the SelectMode property to EffectPolygon. Set the appropriate values in the Point property
  3. To process an elliptical area on the image, set the SelectMode property to EffectEllipse. Set the appropriate values for the bounding rectangle in the Rect property

When the SelectMode property is set to EffectPolygon or EffectEllipse, the values must be set in the Inside property.

If successful the resulting raster image data is set in the DestinationImage property, and the mask image set in the DestinationMask property will be set.

See Also

Effect Class | Effect Members

The ImageKit.NET3 is created by Newtone Corporation