Pinta Effects for Your .NET Apps

Pinta wouldn't exist today without the amazing code from the previously open source Paint.NET.  Now we've decided to pay it forward and make that same code available for other developers to easily use in their applications.

To accomplish this, we've extracted the code for all of Pinta's effects into a graphics toolkit agnostic library called Pinta.ImageManipulation and posted it up on NuGet for easy use.  This includes over 35 multi-threaded effects exposed as cancelable Tasks.

The core of Pinta.ImageManipulation is graphics toolkit agnostic and only works on arrays of BGRA bytes, but we've also included wrappers for System.Drawing (GDI+) and Cairo (GTK+).

Now that you've got all those great new holiday photos, let's see how to apply an effect to them in 5 lines of code.

Create a new project, bring up the NuGet dialog, and search for Pinta:

Select the Pinta.ImageManipulation.System.Drawing package and install it...

..which adds 2 new project references, the toolkit agnostic core and the System.Drawing wrapper.

Now we need to:
  • Load an image into System.Drawing.Bitmap
  • Wrap it into a BitmapWrapper we can pass to Pinta.
  • Create a new emboss effect.
  • Render the emboss effect to the image.
  • Save the result.
var photo = new Bitmap (@"C:\helo.png");
var photo_wrapper = new BitmapWrapper (photo);

var blur = new EmbossEffect ();
await blur.RenderAsync (photo_wrapper);

photo.Save (@"C:\helo2.png");
Resulting in:

A full list of available effects can be found here.

Pinta.ImageManipulation retains Paint.NET and Pinta's MIT X11 license, so feel free to use this in your applications.

If you want to submit new effects, send us a pull request on GitHub:



Wow, amazing! Time to play with it! Congrats, Mr Pobst!
Anonymous said…
This is brilliant Jonathan!

Anonymous said…
Thanks for the info :>

Popular posts from this blog

Hack Week 3

Mono in Visual Studio 2010

Introducing Pinta