ImageGear21.Core Assembly > ImageGear.Processing Namespace > ImGearRasterProcessing Class : Reduce Method |
'Declaration Public Shared Sub Reduce( _ ByVal page As ImGearRasterPage, _ ByVal colorSpace As ImGearColorSpace, _ ByVal channelDepths() As Integer, _ ByVal reductionMethod As ImGearReductionMethods, _ ByVal options As ImGearReductionOptions _ )
'Usage Dim page As ImGearRasterPage Dim colorSpace As ImGearColorSpace Dim channelDepths() As Integer Dim reductionMethod As ImGearReductionMethods Dim options As ImGearReductionOptions ImGearRasterProcessing.Reduce(page, colorSpace, channelDepths, reductionMethod, options)
public static void Reduce( ImGearRasterPage page, ImGearColorSpace colorSpace, int[] channelDepths, ImGearReductionMethods reductionMethod, ImGearReductionOptions options )
public: static void Reduce( ImGearRasterPage* page, ImGearColorSpace colorSpace, int[]* channelDepths, ImGearReductionMethods reductionMethod, ImGearReductionOptions* options )
public: static void Reduce( ImGearRasterPage^ page, ImGearColorSpace colorSpace, array<int>^ channelDepths, ImGearReductionMethods reductionMethod, ImGearReductionOptions^ options )
ImGearReductionMethods.SCALE
does not change the image's color space, but only scales the channel depths. Different reduction methods have their own options, which can be set using the options parameter.
For more information about a particular method, see its options. The following reduction methods are available in ImGearReductionMethods:
Method | Input color spaces and bit depths | Output color spaces and bit depths | Options |
---|---|---|---|
BAYER | RGB (24)Grayscale (8)Indexed (>1) | Indexed (1 or 4) | ImGearBayerReductionOptions |
BITONAL | RGB (24)Grayscale (8)Indexed (>1) | Indexed (1) | ImGearBitonalReductionOptions |
DIFFUSE | RGB (24)Grayscale (8)Indexed (>1) | Indexed (1 or 4) | ImGearDiffuseReductionOptions |
HALFTONE | RGB (24)Grayscale (8)Indexed (>1) | Indexed (1) | ImGearHalftoneReductionOptions |
MEDIAN | RGB (24)Grayscale (8) | Indexed (8) | ImGearMedianCutReductionOptions |
OCTREE | RGB (24)Grayscale (8) | Indexed (4 or 8) | ImGearOctreeReductionOptions |
POPULARITY | RGB (24)Grayscale (8) | Indexed (8) | ImGearPopularityReductionOptions |
SCALE | Any color space except Indexed | Same color space as input | ImGearScaleReductionOptions |
// Reduce the bit depth of an image to 4 bit // Create reduction options object and setup a few values for a 16 color 4-bit reduction. ImGearReductionOptions igReductionOptions = new ImGearReductionOptions(); igReductionOptions.Octree.MaxColors = 16; igReductionOptions.Octree.FastRemap = false; igReductionOptions.Octree.ErrorDiffusion = true; //Apply the reduction using Octree to get a 4-bit index image. ImGearRasterProcessing.Reduce(igRasterPage, new ImGearColorSpace(ImGearColorSpaceIDs.I), new int[] { 4 }, ImGearReductionMethods.OCTREE, igReductionOptions);
' Reduce the bit depth of an image to 4 bit ' Create reduction options object and setup a few values for a 16 color 4-bit reduction. Dim igReductionOptions As New ImGearReductionOptions() igReductionOptions.Octree.MaxColors = 16 igReductionOptions.Octree.FastRemap = False igReductionOptions.Octree.ErrorDiffusion = True 'Apply the reduction using Octree to get a 4-bit index image. ImGearRasterProcessing.Reduce(igRasterPage, New ImGearColorSpace(ImGearColorSpaceIDs.I), New Integer() {4}, _ ImGearReductionMethods.OCTREE, igReductionOptions)