Leadtools.Services.ImageProcessing.ServiceContracts Namespace > IColorProcessingService Interface : ColorResolution Method |
[FaultContractAttribute(DetailType=Leadtools.Services.Raster.FaultContracts.RasterFault, Action="", Name="", Namespace="", ProtectionLevel=ProtectionLevel.None, HasProtectionLevel=false)] [OperationContractAttribute("ColorResolution")] CommandResponse ColorResolution( ColorResolutionRequest request )
'Declaration <FaultContractAttribute(DetailType=Leadtools.Services.Raster.FaultContracts.RasterFault, Action="", Name="", Namespace="", ProtectionLevel=ProtectionLevel.None, HasProtectionLevel=False)> <OperationContractAttribute("ColorResolution")> Function ColorResolution( _ ByVal request As ColorResolutionRequest _ ) As CommandResponse
'Usage Dim instance As IColorProcessingService Dim request As ColorResolutionRequest Dim value As CommandResponse value = instance.ColorResolution(request)
[FaultContractAttribute(DetailType=Leadtools.Services.Raster.FaultContracts.RasterFault, Action="", Name="", Namespace="", ProtectionLevel=ProtectionLevel.None, HasProtectionLevel=false)] [OperationContractAttribute("ColorResolution")] CommandResponse ColorResolution( ColorResolutionRequest request )
FaultContractAttribute(DetailType=Leadtools.Services.Raster.FaultContracts.RasterFault, Action="", Name="", Namespace="", ProtectionLevel=ProtectionLevel.None, HasProtectionLevel=) OperationContractAttribute("ColorResolution") function Leadtools.Services.ImageProcessing.ServiceContracts.IColorProcessingService.ColorResolution( request )
[FaultContractAttribute(DetailType=Leadtools.Services.Raster.FaultContracts.RasterFault, Action="", Name="", Namespace="", ProtectionLevel=ProtectionLevel.None, HasProtectionLevel=false)] [OperationContractAttribute("ColorResolution")] CommandResponse^ ColorResolution( ColorResolutionRequest^ request )
This operation provides flexibility in specifying the output destination and in specifying the palette to use.
For general information about dithering, refer to Color Resolution and Dithering and Dithering Methods.
You can convert the image in place or create a new converted image.
In specifying a palette, you can use simple palette options, or you can specify a palette that is tailored to your needs. The tailored palette can be any size that you specify. It can include specific colors, reserved blank entries, and open entries that this method fills with optimized colors.
NOTE: Using this operation to change the color order of a 24-bit or 32-bit image (i.e. RGB to BGR) will have no effect on the image when painting or saving (to a file). If you want to change the visual appearance, you can simply swap the color order using the Leadtools.Services.ImageProcessing.DataContracts.ColorResolutionRequest.Order property.
This operation does not support signed data images. An exception will be thrown if a signed data image is passed to this operation.
For more information, refer to Introduction - Palette Handling.
Public Sub ColorResolutionExample() Dim client As ColorProcessingServiceClient = New ColorProcessingServiceClient() Dim sourceBinaryData As RawBinaryData = New RawBinaryData() sourceBinaryData.Data = File.ReadAllBytes(Path.Combine(LEAD_VARS.ImagesDir, "image1.cmp")) Dim convertOptions As RasterConvertOptions = New RasterConvertOptions() convertOptions.Source = sourceBinaryData convertOptions.Destination = Nothing convertOptions.Format = RasterImageFormat.Bmp convertOptions.FirstPage = 1 convertOptions.LastPage = 1 convertOptions.BitsPerPixel = 24 convertOptions.QualityFactor = 2 Dim request As ColorResolutionRequest = New ColorResolutionRequest() request.ConvertOptions = convertOptions request.RegionData = Nothing request.BitsPerPixel = 4 request.DitheringMethod = RasterDitheringMethod.None request.Order = RasterByteOrder.Rgb request.PaletteFlags = ColorResolutionCommandPaletteFlags.Optimized Dim response As CommandResponse = client.ColorResolution(request) If Not response.Destination Is Nothing Then If TypeOf response.Destination Is RawBinaryData Then File.WriteAllBytes(Path.Combine(LEAD_VARS.ImagesDir, "ColorResolution.bmp"), (TryCast(response.Destination, RawBinaryData)).Data) End If End If client.Close() End Sub Public NotInheritable Class LEAD_VARS Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" End Class
public void ColorResolutionExample() { ColorProcessingServiceClient client = new ColorProcessingServiceClient(); RawBinaryData sourceBinaryData = new RawBinaryData(); sourceBinaryData.Data = File.ReadAllBytes(Path.Combine(LEAD_VARS.ImagesDir,"image1.cmp")); RasterConvertOptions convertOptions = new RasterConvertOptions(); convertOptions.Source = sourceBinaryData; convertOptions.Destination = null; convertOptions.Format = RasterImageFormat.Bmp; convertOptions.FirstPage = 1; convertOptions.LastPage = 1; convertOptions.BitsPerPixel = 24; convertOptions.QualityFactor = 2; ColorResolutionRequest request = new ColorResolutionRequest(); request.ConvertOptions = convertOptions; request.RegionData = null; request.BitsPerPixel = 4; request.DitheringMethod = RasterDitheringMethod.None; request.Order = RasterByteOrder.Rgb; request.PaletteFlags = ColorResolutionCommandPaletteFlags.Optimized; CommandResponse response = client.ColorResolution(request); if (response.Destination != null) { if (response.Destination is RawBinaryData) File.WriteAllBytes(Path.Combine(LEAD_VARS.ImagesDir,"ColorResolution.bmp"), (response.Destination as RawBinaryData).Data); } client.Close(); } static class LEAD_VARS { public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2