Processing Commands
The ImageSharp.Web processing API is imperative. This means that the order in which you supply the individual processing operations is the order in which they are compiled and applied. This allows the API to be very flexible, allowing you to combine processes in any order.
Note
It is possible to configure your own processing command pipeline by implementing and registering your own version of the IRequestParser interface.
The following processors are built into the middleware. In addition extension points are available to register your own command processors.
Resize
Allows the resizing of images.
{PATH_TO_YOUR_IMAGE}?width=300
{PATH_TO_YOUR_IMAGE}?width=300&height=120&rxy=0.37,0.78
{PATH_TO_YOUR_IMAGE}?width=50&height=50&rsampler=nearest&rmode=stretch
Resize commands represent the ResizeOptions class.
widthThe width of the image in px. Use only one dimension to preseve the aspect ratio.heightThe height of the image in px. Use only one dimension to preseve the aspect ratio.rmodeThe ResizeMode to use.rsamplerThe IResampler sampler to use.bicubicBicubicnearestNearestNeighborboxBoxmitchellMitchellNetravalicatmullCatmullRomlanczos2Lanczos2lanczos3Lanczos3lanczos5Lanczos5lanczos8Lanczos8welchWelchrobidouxRobidouxrobidouxsharpRobidouxSharpsplineSplinetriangleTrianglehermiteHermite
ranchorThe AnchorPositionMode to use.rxyUse an exact anchor position point. The comma-separated x and y values range from 0-1.compandWhether to compress and expand individual pixel colors values to/from a linear color space when processing.
Format
Allows the encoding of the output image to a new image format. The available formats depend on your configuration settings.
{PATH_TO_YOUR_IMAGE}?format=jpg
{PATH_TO_YOUR_IMAGE}?format=gif
{PATH_TO_YOUR_IMAGE}?format=png
{PATH_TO_YOUR_IMAGE}?format=bmp
{PATH_TO_YOUR_IMAGE}?format=tga
Quality
Allows the encoding of the output image at the given quality.
- For Jpeg this ranges from 1—100.
{PATH_TO_YOUR_IMAGE}?quality=90
{PATH_TO_YOUR_IMAGE}?format=jpg&quality=42
Note
Only certain formats support adjustable quality. This is a constraint of individual image standards not the API.
Background Color
Allows the changing of the background color of transparent images.
{PATH_TO_YOUR_IMAGE}?bgcolor=FFFF00
{PATH_TO_YOUR_IMAGE}?bgcolor=C1FF0080
{PATH_TO_YOUR_IMAGE}?bgcolor=red
{PATH_TO_YOUR_IMAGE}?bgcolor=128,64,32
{PATH_TO_YOUR_IMAGE}?bgcolor=128,64,32,16