Provides support for converting buffered image data from one color space to another.
public static class RasterColorSpace Public MustInherit NotInheritable Class RasterColorSpace public ref class RasterColorSpace abstract sealed This example will load an image, resizes each line then saves the resized image back to disk.
using Leadtools;using Leadtools.Codecs;using LeadtoolsExamples.Common;public void RasterColorSpaceExample(){string fileName = Path.Combine(ImagesPath.Path, "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);}}}
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:\Users\Public\Documents\LEADTOOLS Images"End Class
using Leadtools;using Leadtools.Codecs;using Leadtools.Examples;public void RasterColorSpaceExample(RasterImage image){// Allocate the input buffer for 24-bit RGB databyte[] inBuffer = new byte[image.Width * 3];// 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);// Cleanupimage.Dispose();}
Imports LeadtoolsImports Leadtools.CodecsPublic Sub RasterColorSpaceExample(ByVal image As RasterImage)' 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 Sub
|
Products |
Support |
Feedback: RasterColorSpace Class - Leadtools |
Introduction |
Help Version 19.0.2017.6.19
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.