Gets the width (in bytes) of the scan line.
Namespace:
Aurigma.GraphicsMill
Assembly:
Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
public int Stride { get; }
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"); }