Getting Pixel Data with SkiaSharp
Serious image processing means working directly with pixels rather than calling high-level APIs. David Britch, drawing on a Mac Catalyst image-processing prototype, walks through SkiaSharp’s pixel-access options and implements several classic operations.
What you’ll learn
- Choosing the right type — why
SKBitmapreliably exposes pixel data whereSKImagereturned null in SkiaSharp 3 - The fastest access path — using
GetPixelsto get a pointer and using pointer arithmetic to read/write pixels - Platform pixel layout — RGBA8888 on Apple platforms and Android versus BGRA on Windows
- Worked examples — implementing greyscale and sepia conversions, plus Otsu’s thresholding for binarisation
- Wiring it into MVVM — calling these operations as extension methods on an
SKBitmapfrom a view model
Read the full post for the complete extension-method code and screenshots of each operation.