A .NET Standard library which wraps the System.Drawing.Bitmap class for improved pixel read/write performance.
The benchmark graph below shows just how much faster FastBitmap is. When using the fastest mode it can see speed increases up to 20,000% on a single core. These benchmarks were taken on 9/5/2020 using a Ryzen 9 3950X 16C/32T CPU
// Loads image from file.
using (FastBitmap bmp = FastBitmap.FromFile("image.png"))
{
// Gets the color of pixel 0, 0 and sets it to pixel 1, 1.
Color c = bmp.Get(0, 0);
bmp.Set(1, 1, c);
// Gets the color of pixel at index 1 and sets it to index 2.
// Using indices is faster than coordinates.
c = bmp.Get(1);
bmp.Set(2, c);
// Grabbing color from index 3 and setting it to index 4.
// Using int (ARGB32) for color is much faster than the other methods.
int color32 = bmp.GetI(3);
bmp.SetI(4, color32);
// Saves image to a file.
bmp.Save("image0.png", ImageFormat.Png);
}
Want to help move this project forward? Consider contributing to the project. There are many different ways you can help out, even if you don't want to submit code changes.
The easiest way to contribute is to have this repo as a dependency in your projects. This contribution gives the project more recognition and likely to be seen by other developers, thereby growing the community.
If you would like to make changes to the codebase or documentation, you can submit a pull request. Make sure to check out the CONTRIBUTE.md for pull request requirements.
#4 On some Linux distros, performing GDI+ (System.Drawing.Graphics) operations result in a desync from the BaseBitmap and FastBitmap.Data.