This plugin provides grayscale, sepia, brightness, saturation, contrast, inversion, and alpha filtering options. It also includes beta support for rounded corners.
These filters are implemented as adjustment matrices and are processed by native code for very high performance.
Refresh for another image.
Installation
Either run Install-Package ImageResizer.Plugins.SimpleFilters
in the NuGet package manager, or:
- Add
ImageResizer.Plugins.SimpleFilters.dll
to your project - Add
<add name="SimpleFilters" />
inside<resizer><plugins></plugins></resizer>
in Web.config.
Usage (v3.1+)
Note the order in which effects are applied MAY CHANGE in future releases.
s.grayscale=true|y|ry|ntsc|bt709|flat
(true, ntsc, and y produce identical results)s.sepia=true
s.alpha= 0..1
s.brightness=-1..1
s.contrast=-1..1
s.saturation=-1..1
s.invert=true
s.roundcorners=radius|topleft,topright,bottomright,bottomleft
- 'radius' is a percentage between 0 and 100 of 1/2 the smaller of width and height. You can crop to a circle withwidth=x&height=x&mode=crop&s.roundcorners=100
Examples
Evenly rounded
s.roundcorners=30
Specify individual radii
s.roundcorners=45,0,45,0
4 ways to grayscale
s.grayscale
=true|y|ry|ntsc|bt709|flat
(true, ntsc, and y produce identical results)
The following examples use NTSC/Y/True, RY, BT709, and Flat respectively
1 way to sepia
s.sepia=true
Inversion
s.invert=true
Adjust opacity/alpha
s.alpha
= 0..1
For true transparency, combine with format=png
. Otherwise, the image will be blended against bgcolor
.
Adjust contrast
s.contrast
= -1..1
Adjust brightness
s.brightness
=-1..1
Adjust saturation
s.saturation
= -1..1
Legacy syntax (Before v3.1)
- &filter=grayscale
- &filter=sepia (didn't work)
- &filter=brightness(.1) (-1..1) (Change .1 to the brightness offset you want)
- &filter=alpha(.5) (Change .5 to the alpha multiplier you want)
This plugin (SimpleFilters 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?
- In Visual Studio, right click on your project and choose "Add reference". Browse to the plugin DLL and click "OK".
- In the <plugins> section of Web.config, insert <add name="PluginName" />
- Look at the plugin documentation to see what configuration options (if any) are available.