---
title: "Bitmap.Stride Property "
canonical: https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Bitmap_Stride.htm
product: "Graphics Mill"
---

# Bitmap.Stride Property 
 
Gets the width (in bytes) of the scan line.
 
**Namespace:** [Aurigma.GraphicsMill](https://www.graphicsmill.com/docs/gm/N_Aurigma_GraphicsMill.htm.md)
 **Assembly:** Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
 
## Syntax
  
```csharp
public int Stride { get; }
```
 
### Property Value
The width of the scan line.
 
## Remarks
 Since the [Width](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Bitmap_Width.htm.md) property returns a number of pixels in single scan line, this property contains number of bytes in a scan line. As scan line may be aligned on four-bytes boundary, stride may differ from bitmap data width multiplied on number of bytes per pixel. That's why you should use this property to move to the same position on the next row instead of any other methods.
 
## Examples
  
```csharp
using (var bitmap = new Bitmap(@"Images\in.jpg"))
{
    unsafe
    {
        //A pointer to the beginning of the pixel data region
        byte* pointer = (byte*)(bitmap.Scan0.ToPointer());
        //Number of bytes in a row
        int stride = bitmap.Stride;
        //Number of rows
        int height = bitmap.Height;

        for (int i = 0; i < height; i++)
        {
            byte* position = pointer + stride * i;
            for (int j = 0; j < stride; j++)
            {
                //Now we can modify the pixel, for example, invert it
                *position = (byte)(255 - *position);
                position++;
            }
        }
    }
    bitmap.Save(@"Images\Output\out.jpg");
}
```
   
## See Also

### Reference

- [Bitmap Class](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Bitmap.htm.md)
- [Aurigma.GraphicsMill Namespace](https://www.graphicsmill.com/docs/gm/N_Aurigma_GraphicsMill.htm.md)

### Manual

- [Accessing Pixel Data](https://www.graphicsmill.com/docs/gm/accessing-pixel-data.htm.md)
