Skip to content

IImageExtensions Class#

Extends the IImage interface.

Inheritance Hierarchy#

System.Object
  Basler.Pylon.IImageExtensions

Syntax#

C#

public static class IImageExtensions

VB

<ExtensionAttribute>
Public NotInheritable Class IImageExtensions

The IImageExtensions type exposes the following members.

Methods#

 NameDescription
Public methodStatic memberComputeStride Computes the stride of the image in bytes. Returns null if the stride cannot be computed.
Public methodStatic memberDisplay Uses the ImageWindow method DisplayImage(Int32, IImage) to display the image.
 

IImageExtensions.ComputeStride Method#

Computes the stride of the image in bytes. Returns null if the stride cannot be computed.

Syntax#

C#

public static int? ComputeStride(
    this IImage image
)

VB

<ExtensionAttribute>
Public Shared Function ComputeStride ( 
    image As IImage
) As Integer?

Parameters#
image
Type: Basler.Pylon.IImage
The interface of the image.
Return Value#

Type: Nullable(Int32)
Returns the stride of the image in bytes. Returns null if the stride cannot be computed.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type IImage. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks#

The stride indicates the distance in bytes from the beginning of one image row to the beginning of the next row. For planar pixel types, the returned value represents the stride of a plane.

The stride in bytes cannot be computed for packed image format when the stride is not byte aligned and paddingX == 0. If paddingX is larger than zero and the stride without padding is not byte aligned, the rest of the partially filled byte is considered as padding. For example, if padding is set to 10, pixelType is PixelType_Mono12packed, and the image width is 5, the stride without padding is 12 * 5 = 60 bits = 7.5 bytes. The remaining 0.5 are considered as padding, which results in a stride of 18 bytes.

Error Safety: Does not throw exceptions.

IImageExtensions.Display Method#

Uses the ImageWindow method DisplayImage(Int32, IImage) to display the image.

Syntax#

C#

public static void Display(
    this IImage image,
    int windowIndex
)

VB

<ExtensionAttribute>
Public Shared Sub Display ( 
    image As IImage,
    windowIndex As Integer
)

Parameters#
image
Type: Basler.Pylon.IImage
The image to display. The image must be valid. Otherwise, the image window opens, but no image is shown.
windowIndex
Type: System.Int32
The window index used to display the image. Valid window indexes range from 0 to 31.
Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type IImage. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).