Skip to content

🌐 Middleware for ASP.NET-Core for image manipulation.

Notifications You must be signed in to change notification settings

yohsii/ImageSharp.Web

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SixLabors.ImageSharp.Web
SixLabors.ImageSharp.Web

GitHub license GitHub issues GitHub stars GitHub forks Gitter

Twitter OpenCollective OpenCollective

ImageSharp.Web is a new high-performance ASP.NET Core middleware leveraging the ImageSharp graphics library.

Pre-release downloads are available from the MyGet package repository.

Build Status
Linux/Mac Build Status
Windows Build status

Installation

Install stable releases via Nuget; development releases are available via MyGet.

Package Name Release (NuGet) Nightly (MyGet)
SixLabors.ImageSharp.Web NuGet MyGet

Packages

  • ImageSharp.Web
    • Contains the middleware to integrate a dynamic image manipulation workflow into an ASP.NET Core application.

Once installed you will need to add the following code to ConfigureServices in your Startup.cs file.

This installs the the default service and options.

// Add the default service and options.
services.AddImageSharp();

Or add the default service and custom options.

// Add the default service and custom options.
services.AddImageSharp(
    options =>
        {
            // You only need to set the options you want to change here.
            options.Configuration = Configuration.Default;
            options.MaxBrowserCacheDays = 7;
            options.MaxCacheDays = 365;
            options.CachedNameLength = 8;
            options.OnParseCommands = _ => { };
            options.OnBeforeSave = _ => { };
            options.OnProcessed = _ => { };
            options.OnPrepareResponse = _ => { };
        });

Or you can fine-grain control adding the default options and configure other services.

// Fine-grain control adding the default options and configure other services.
services.AddImageSharp()
        .RemoveProcessor<FormatWebProcessor>()
        .RemoveProcessor<BackgroundColorWebProcessor>();

There are also factory methods for each builder that will allow building from configuration files.

// Use the factory methods to configure the PhysicalFileSystemCacheOptions
services.AddImageSharpCore(
    options =>
        {
            options.Configuration = Configuration.Default;
            options.MaxBrowserCacheDays = 7;
            options.MaxCacheDays = 365;
            options.CachedNameLength = 8;
            options.OnParseCommands = _ => { };
            options.OnBeforeSave = _ => { };
            options.OnProcessed = _ => { };
            options.OnPrepareResponse = _ => { };
        })
    .SetRequestParser<QueryCollectionRequestParser>()
    .SetMemoryAllocator(provider => ArrayPoolMemoryAllocator.CreateWithMinimalPooling())
    .Configure<PhysicalFileSystemCacheOptions>(options =>
    {
        options.CacheFolder = "different-cache";
    })
    .SetCache<PhysicalFileSystemCache>()
    .SetCacheHash<CacheHash>()
    .AddProvider<PhysicalFileSystemProvider>()
    .AddProcessor<ResizeWebProcessor>()
    .AddProcessor<FormatWebProcessor>()
    .AddProcessor<BackgroundColorWebProcessor>();

Manual build

If you prefer, you can compile ImageSharp.Web yourself (please do and help!), you'll need:

Alternatively on Linux you can use:

To clone it locally click the "Clone in Windows" button above or run the following git commands.

git clone https://github.com/SixLabors/ImageSharp.Web

How can you help?

Please... Spread the word, contribute algorithms, submit performance improvements, unit tests, no input is too little. Make sure to read our Contribution Guide before opening a PR.

The ImageSharp.Web Team

Grand High Eternal Dictator

Core Team

Backers

Support us with a monthly donation and help us continue our activities. [Become a backer]

Sponsors

Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]

About

🌐 Middleware for ASP.NET-Core for image manipulation.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 98.2%
  • PowerShell 1.4%
  • Batchfile 0.4%