WhitespaceTrimmer plugin

Trims whitespace (even smooth gradients) from around images automatically using edge detection filters. Requires Full Trust, uses unmanaged code.



Settings: &trim.threshold = 80 , &trim.percentpadding = 0.5


Add &trim.threshold=80 to an image URL. You'll probably also want to restore a bit of padding with &trim.percentpadding=0.5 since it's ugly to trim completely to the edge of the object.

The threshold value can usually go all the way up to 255 without cutting off any part of the image. The percentpadding value can be anywhere between 0 and 50, but 0.5-2 is usually the best.


Either run Install-Package ImageResizer.Plugins.WhitespaceTrimmer in the NuGet package manager, or:

  1. Add ImageResizer.Plugins.WhitespaceTrimmer.dll to your project. Make sure AForge.dll, AForge.Math.dll, and AForge.Imaging.dll are copied also, although they do not need to be referenced directly.
  2. Add <add name="WhitespaceTrimmer" /> inside <resizer><plugins></plugins></resizer> in Web.config.

This plugin (WhitespaceTrimmer plugin) is part of the Creative Edition

Where is the plugins section?

The <plugins> section is located in Web.config, and is nested inside the <resizer> element, which is nested inside <configuration>. For examples, see this sample Web.config file.

Where can I find the dll?

We prefer that you install via NuGet, but you can also find the plugin DLL files in the /dlls/release folder of your download.

How do I typically install a plugin via Web.Config?

  1. In Visual Studio, right click on your project and choose "Add reference". Browse to the plugin DLL and click "OK".
  2. In the <plugins> section of Web.config, insert <add name="PluginName" />
  3. Look at the plugin documentation to see what configuration options (if any) are available.

How do I typically install a plugin via code?