Provides support for converting buffered image data from one color space to another.
Syntax
Visual Basic (Declaration) | |
---|
Public MustInherit NotInheritable Class RasterColorSpace |
C# | |
---|
public static class RasterColorSpace |
C++/CLI | |
---|
public ref class RasterColorSpace abstract sealed |
Example
This example will load an image, resizes each line then saves the resized image back to disk.
Visual Basic | Copy Code |
---|
Public Sub RasterColorSpaceExample()
RasterCodecs.Startup()
Dim codecs As RasterCodecs = New RasterCodecs()
Dim fileName As String = LeadtoolsExamples.Common.ImagesPath.Path + "Image1.cmp"
Dim image As RasterImage = codecs.Load(fileName)
Dim inBuffer As Byte() = New Byte(image.Width * 3 - 1) {}
Dim outBuffer As Byte() = New Byte(image.Width * 4 - 1) {}
image.Access()
image.GetRow(0, inBuffer, 0, image.BytesPerLine)
image.Release()
RasterColorSpace.Convert8(inBuffer, 0, outBuffer, 0, image.Width, RasterColorSpaceFormat8.Rgb, RasterColorSpaceFormat8.Cmyk)
image.Dispose()
RasterCodecs.Shutdown()
End Sub |
C# | Copy Code |
---|
public void RasterColorSpaceExample() { RasterCodecs.Startup(); RasterCodecs codecs = new RasterCodecs(); // load an image string fileName = LeadtoolsExamples.Common.ImagesPath.Path + "Image1.cmp"; RasterImage image = codecs.Load(fileName); // Allocate the input buffer for 24-bit RGB data byte[] inBuffer = new byte[image.Width * 3]; // Allocate the output buffer for 32-bit CMYK data byte[] outBuffer = new byte[image.Width * 4]; // Get one row of data from the bitmap image.Access(); image.GetRow(0, inBuffer, 0, image.BytesPerLine); image.Release(); // Convert the data from RGB in inBuffer to CMYK in outBuffer RasterColorSpace.Convert8(inBuffer, 0, outBuffer, 0, image.Width, RasterColorSpaceFormat8.Rgb, RasterColorSpaceFormat8.Cmyk); // Cleanup image.Dispose(); RasterCodecs.Shutdown(); } |
Inheritance Hierarchy
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family
See Also