Skip to content

Latest commit

 

History

History
33 lines (29 loc) · 1.15 KB

README.md

File metadata and controls

33 lines (29 loc) · 1.15 KB

SimpleImageEditing

Edit SoftwareBitmap objects by pixel without operating on bytes or compiling with unsafe flag

Installing Nuget Package and Dependencies

  • This requires your project to be a Windows 10 Universal App project
  • Right click project references -> Manage Nuget Packages
  • Search and install SimpleImageEditing nuget package

Supported image types

Currently only supports BGRA8 Software Bitmap objects. To convert to supported format:

SoftwareBitmap supported = SoftwareBitmap.Convert(toConvert, BitmapPixelFormat.Bgra8, BitmapAlphaMode.Premultiplied);

Basic Example (Turns image green)

using (SoftwareBitmapEditor editor = new SoftwareBitmapEditor(input))
{
    for (uint y = 0; y < editor.height; y++)
    {
        for (uint x = 0; x < editor.width; x++)
        {
            SoftwareBitmapPixel pixel = editor.getPixel(x, y);
            editor.setPixel(x, y, pixel.r, (byte)Math.Min(pixel.g + 100, 255), pixel.b);
        }
    }
}

Useful links