Skip to content
A .NET imaging library that extends System.Drawing functionality
Branch: master
Clone or download
Latest commit c20d49a Aug 29, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
Binary Revert "New Strategy - still sucks" Jul 29, 2014
BumpKit Removes unnecessary byte. Oct 18, 2014
.gitattributes Initial 1.0.0 Commit Jul 6, 2012
.gitignore Initial 1.0.0 Commit Jul 6, 2012
LICENSE Create LICENSE Aug 29, 2019 Update Aug 29, 2019

Bumpkit (1.0.1 Documentation)

This is a .NET library that extends the System.Drawing GDI libraries. Useful for on-the-fly image generation in .NET-based web applications.


  • Image sizing/scaling extensions
  • Image rotation extensions
  • Lightning-fast pixel manipulation
  • Animated GIF generation (utilizes native gif encoding)
  • Font bordering and glow effects (DrawString on steroids)
  • Other extensions (Point, Color, etc)



  • Resize images with a single extension method
  • Maintain image aspect ratio sizing to a height or width or confine to a boundary



  • Rotate images with a single extension method
  • Maintain image centering to boundaries and scale to fit or maintain sizing ratio

Fast Pixel Access:


  • Provides access to an Image's pixels in a locked session
  • Allows lightning-fast custom image manipulation
  • Provides direct memory access wrapped in a light-weight disposable context

Animated GIF Generation:


  • Formats multiple images/frames into a single animated GIF file
  • Utilizes native .NET GIF encoding (simply adds missing animation file-headers)
  • Fast (relative to other GIF libraries)

Font Effects:

System.Drawing.Graphics.DrawString(text, font, brush, x, y, border, borderColors, colorOffsets)

  • Utilizes native .NET font processing
  • Fast effect generation
  • Flexible API implementation


Scaling an image to fit a specified size maintaining scale ratio

var scaledImage = Image.FromFile("").ScaleToFit(new Size(100, 100));

Scaling an image to "overflow" or "cover" a specified size maintaining scale ratio

var scaledImage = Image.FromFile("").ScaleToFit(new Size(100, 100), ScalingMode.Overflow);

Scaling an image without disposing the original image

var img = Image.FromFile("");
var scaledImage = img.ScaleToFit(new Size(100, 100), false);
var scaledImage2 = img.ScaleToFit(new Size(100, 100), false, ScalingMode.Overflow);

Stretching an image to fit a specified size

var stretchedImage = Image.FromFile("").Stretch(new Size(100, 100));

Rotating an image

var rotationOverflow = Image.FromFile("").Rotate(45);
var rotationFit = Image.FromFile("").Rotate(45, ScalingMode.FitContent); // scales down to fit corner content

Detecting Image Edges (finding the crop points)

var pixelBoundary = Image.FromFile("").DetectPadding(); // you can also specify the background color if it is not transparent

Direct Memory Access (reading/writing pixels quickly)

// NOTE: This locks and accesses the bitmap's unmanaged memory. This is NOT thread-safe.
var image = Image.FromFile("");
using (var context = image.CreateUnsafeContext())
	for (var x = 0; x < context.Width; x++)
		for (var y = 0; y < context.Height; y++)
			var pixel = context.GetRawPixel(x, y);
			var average = Convert.ToByte((pixel.Red + pixel.Green + pixel.Blue)/3d);
			context.SetPixel(x, y, pixel.Alpha, average, average, average);

Animated Gif Encoding

using (var image = Image.FromFile(""))
using (var gif = File.OpenWrite(""))
using (var encoder = new GifEncoder(gif))
	for (var i = 0; i < 360; i += 10)
		using (var frame = image.Rotate(i, false))

Font Borders

var img = new Bitmap(600, 200);
using (var gfx = Graphics.FromImage(img))
using (var font = new Font(SystemFonts.DefaultFont.FontFamily, 50))
	gfx.SmoothingMode = SmoothingMode.AntiAlias;
	gfx.DrawString("ABCabc123", font, Brushes.Black, 0, 0, 50,
		new[] {Color.Red, Color.Green, Color.Blue},
		new[] {0f, 0.5f, 1f});
You can’t perform that action at this time.