←Select platform

Convert8(IntPtr,IntPtr,int,RasterColorSpaceFormat8,RasterColorSpaceFormat8) Method

Summary
Converts 8-bit unmanaged image data from one color space to another.
Syntax
C#
C++/CLI
Python
public static void Convert8( 
   IntPtr inBuffer, 
   IntPtr outBuffer, 
   int width, 
   RasterColorSpaceFormat8 inFormat, 
   RasterColorSpaceFormat8 outFormat 
) 
public: 
static void Convert8(  
   IntPtr inBuffer, 
   IntPtr outBuffer, 
   int width, 
   RasterColorSpaceFormat8 inFormat, 
   RasterColorSpaceFormat8 outFormat 
)  

Parameters

inBuffer
An unmanaged pointer containing the source image data

outBuffer
An array of bytes to be filled with the converted image data

width
Image width, in pixels

inFormat
The format of the input data

outFormat
The desired format of the converted data

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
 
 
public void RasterColorSpaceExample() 
{ 
	string fileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp"); 
	using (RasterCodecs codecs = new RasterCodecs()) 
	{ 
		// load an image 
		using (RasterImage image = codecs.Load(fileName)) 
		{ 
			// Allocate the input buffer for 24-bit RGB data  
			byte[] inBuffer = new byte[image.Width * 3]; 
			Assert.IsTrue(inBuffer.Length == image.BytesPerLine); 
 
			// 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); 
		} 
	} 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.