public static class RasterColorSpace Public MustInherit NotInheritable Class RasterColorSpace public ref class RasterColorSpace abstract sealed This example will load an image, resize each line, then save the resized image back to disk.
using Leadtools;using Leadtools.Codecs;public void RasterColorSpaceExample(){string fileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp");using (RasterCodecs codecs = new RasterCodecs()){// load an imageusing (RasterImage image = codecs.Load(fileName)){// Allocate the input buffer for 24-bit RGB databyte[] inBuffer = new byte[image.Width * 3];Assert.IsTrue(inBuffer.Length == image.BytesPerLine);// Allocate the output buffer for 32-bit CMYK databyte[] outBuffer = new byte[image.Width * 4];// Get one row of data from the bitmapimage.Access();image.GetRow(0, inBuffer, 0, image.BytesPerLine);image.Release();// Convert the data from RGB in inBuffer to CMYK in outBufferRasterColorSpace.Convert8(inBuffer, 0, outBuffer, 0, image.Width, RasterColorSpaceFormat8.Rgb, RasterColorSpaceFormat8.Cmyk);}}}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images";}
Imports LeadtoolsImports Leadtools.CodecsPublic Sub RasterColorSpaceExample()Dim codecs As RasterCodecs = New RasterCodecs()' load an imageDim fileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp")Dim image As RasterImage = codecs.Load(fileName)' Allocate the input buffer for 24-bit RGB dataDim inBuffer As Byte() = New Byte(image.Width * 3 - 1) {}' Allocate the output buffer for 32-bit CMYK dataDim outBuffer As Byte() = New Byte(image.Width * 4 - 1) {}' Get one row of data from the bitmapimage.Access()image.GetRow(0, inBuffer, 0, image.BytesPerLine)image.Release()' Convert the data from RGB in inBuffer to CMYK in outBufferRasterColorSpace.Convert8(inBuffer, 0, outBuffer, 0, image.Width, RasterColorSpaceFormat8.Rgb, RasterColorSpaceFormat8.Cmyk)' Cleanupimage.Dispose()End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images"End Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
