Visual Basic (Declaration) | |
---|---|
Public Overloads Function GetPixelData( _ ByVal row As Integer, _ ByVal column As Integer _ ) As Byte() |
Visual Basic (Usage) | Copy Code |
---|---|
|
Parameters
- row
- The zero-based row number of the pixel.
- column
- The zero-based column number of the pixel
Return Value
This method returns a byte array which may represent an index into an images's palette, a grayscale value (Document/Medical only), or red, green, and blue color values.This example uses GetPixelData and SetPixelData methods to swap the R and G values for a particular pixel.
Visual Basic | Copy Code |
---|---|
Public Sub GetPixelDataExample() |
C# | Copy Code |
---|---|
public void GetPixelDataExample() |
No transformations are performed on the pixel data.
This method should be called only for 8, 16, 24, 32, 48 and 64-bit images. It works as follows:
For 8-bit images, this method will retrieve the palette index for the specified pixel. For 16-bit images, this method will retrieve the 2-byte value that forms the pixel. For grayscale 16-bit images, the data will contain the gray value. RasterImage.LowBit and RasterImage.HighBit properties indicate the valid pixel data. For color 16-bit images, the data contains packed 5-bit R, G and B values. The high bit contains the alpha information. The Order determines whether the data is RGB or BGR.
The minimum size of the returned byte array is calculated:
(
You can use the SetPixelData method to assign the returned value to another pixel.
This method uses image coordinates to specify the pixel. Therefore, you must account for the view perspective of the image. If you specify a pixel that is outside the image or outside the region (if the image has one), this method throws an exception.
The SetPixelData method changes the data of the specified pixel.
For more information, refer to Introduction to Image Processing With LEADTOOLS.
For more information refer to Accounting for View Perspective.
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family