• Articles
  • API Documentation
Search Results for

    Show / Hide Table of Contents
    • ImageSharp
      • Getting Started
        • Pixel Formats
        • Image Formats
        • Processing Images
          • Resizing Images
        • Working with Pixel Buffers
        • Configuration
        • Memory Management
    • ImageSharp.Drawing
      • Getting Started
    • ImageSharp.Web
      • Getting Started
        • Processing Commands
        • Image Providers
        • Image Caches
    • Fonts
      • Getting Started
      • Custom Rendering

    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.

    • width The width of the image in px. Use only one dimension to preseve the aspect ratio.
    • height The height of the image in px. Use only one dimension to preseve the aspect ratio.
    • rmode The ResizeMode to use.
    • rsampler The IResampler sampler to use.
      • bicubic Bicubic
      • nearest NearestNeighbor
      • box Box
      • mitchell MitchellNetravali
      • catmull CatmullRom
      • lanczos2 Lanczos2
      • lanczos3 Lanczos3
      • lanczos5 Lanczos5
      • lanczos8 Lanczos8
      • welch Welch
      • robidoux Robidoux
      • robidouxsharp RobidouxSharp
      • spline Spline
      • triangle Triangle
      • hermite Hermite
    • ranchorThe AnchorPositionMode to use.
    • rxy Use an exact anchor position point. The comma-separated x and y values range from 0-1.
    • compand Whether 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
    
    • Improve this Doc
    In This Article
    Back to top Generated by DocFX