You are here: GdPicture.NET > Documentation > Classes > GdPictureImaging Class > GdPictureImaging Methods > Pixel Access > GetPixelArrayByte8bpp Method
logo.gif
ContentsIndexHome
PreviousUpNext
GdPictureImaging.GetPixelArrayByte8bpp Method

Stores into an array of bytes the pixel indexes of an area of a paletized 8bpp GdPicture image.

C#
public GdPictureStatus GetPixelArrayByte8bpp(
    int ImageID, 
    ref Byte arPixels, 
    int SrcLeft, 
    int SrcTop, 
    int Width, 
    int Height
);
Visual Basic
Public Function GetPixelArrayByte8bpp(
    ByVal ImageID As Integer, 
    ByRef arPixels() As Byte, 
    ByVal SrcLeft As Integer, 
    ByVal SrcTop As Integer, 
    ByVal Width As Integer, 
    ByVal Height As Integer
) As GdPictureStatus
Parameters
Parameters 
Description 
ImageID 
GdPicture Image Identifier.  
arPixels 
Output parameter. Array of pixel indexes. each entry of the array is a reference to a palette index [0 - 255].  
SrcLeft 
The left source pixel of the area.  
SrcTop 
The top source pixel of the area.  
Width 
The width of the area in pixel.  
Height 
The height of the area in pixel.  
Returns

A member of the GdPictureStatus enumeration.

This function works only with 8bpp image.

usage of GetPixelArrayByte8bpp() and SetPixelArrayByte8bpp() functions to apply negative effect on a 8bpp grayscale GdPicture image.

Dim oGdPictureImaging As New GdPictureImaging
Dim arPixel() As Byte
Dim X As Integer
Dim Y As Integer
Dim ImageID As Integer
Dim ImageHeight As Integer
Dim ImageWidth As Integer
 
oGdPictureImaging.SetLicenseNumber("XXX") 'Replace XXX by a demo or commercial license key
ImageID = oGdPictureImaging.CreateGdPictureImageFromFile("8bppimage.tif")
ImageHeight = oGdPictureImaging.GetHeight(ImageID)
ImageWidth = oGdPictureImaging.GetWidth(ImageID)
 
ReDim arPixel(ImageWidth * ImageHeight)
oGdPictureImaging.GetPixelArrayByte8bpp(ImageID, arPixel, 0, 0, ImageWidth, ImageHeight)
 
For X = 0 To ImageWidth - 1
   For Y = 0 To ImageHeight - 1
      arPixel((Y * ImageWidth) + X) = Not arPixel((Y * ImageWidth) + X)
   Next Y
Next X
oGdPictureImaging.SetPixelArrayByte8bpp(ImageID, arPixel, 0, 0, ImageWidth, ImageHeight)
oGdPictureImaging.SaveAsTIFF(ImageID, "8bppimageneg.tif", TiffCompression.TiffCompressionAUTO)
oGdPictureImaging.ReleaseGdPictureImage(ImageID)
What do you think about this topic? Send feedback!
Copyright (c) 2009-2011 www.gdpicture.com. All rights reserved.