High performance bitmap with a focus on pixel-level editing. No more lock bits.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



High performance bitmap with a focus on pixel-level editing. No more lock bits.

Why use PixelMap?

When manipulating a Bitmap at the pixel level, the GetPixel and SetPixel approach is simply lackluster. Apart from the ugly Java-like syntax, these methods are magnitudes slower than they should be due to the layers of extra complexity contained within GDI.

Many solutions to this issue go through the route of low level memory management ('lockbits'), an ugly route that requires unsafe code to be written. Whilst this offers the speed desired, it also adds unnecessary complexity to your code.

PixelMap solves this issue by replacing the Bitmap class entirely, offering a sleeker and faster approach to image manipulation. When an image needs to be converted to or from GDI's Bitmap, the low level memory management is handled out of sight safely.

Color is handled by the Pixel class, filling in where GDI failed, such as HSL color constructors and color mixers.


PixelMap is best installed through NuGet.

Install-Package PixelMap

By Example

Changing Hue

This simple example loads and saves an image, modifying the hue of the pixels.

//Quickly load a PixelMap through a Bitmap
PixelMap map = new PixelMap("Lenna.png");

for (int x = 0; x < map.Width; x++)
  for (int y = 0; y < map.Height; y++)
    //Sample a pixel
    Pixel pixel = map[x, y];
    //Create a hue value
    double value = ((double)x/map.Width)*360d;
    //Set the hue value to our sample
    pixel.Hue = value;
    //Return our sample to the PixelMap
    map[x, y] = pixel;
//Save the PixelMap through a Bitmap