Skip to content
📷 A cross-platform library for the processing of image files; written in C#
C# Other
  1. C# 99.1%
  2. Other 0.9%
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Added funding file with a link to open collective. May 25, 2019
.vscode Update .vscode files Feb 18, 2018
build/icons New logo Mar 12, 2018
src remove SteppedRange (#980) Aug 17, 2019
standards @ 8b085c0 Fix build/test (#923) Jun 4, 2019
tests remove some redundant usings (#976) Aug 16, 2019
.editorconfig Updating the repo to use Directory.Build.props/targets files (#920) Jun 1, 2019
.gitattributes Master cleanup (#952) Jul 29, 2019
.gitignore Master cleanup (#952) Jul 29, 2019
.gitmodules Update dependencies + fix stylecop (#816) Jan 25, 2019
.travis.yml I'm terrible copy-paster Apr 22, 2019
CodeCoverage.runsettings Fixing indentation in runsettings. Dec 19, 2016
Directory.Build.props Improve robustness of huffman decoder. Jun 4, 2019
Directory.Build.targets Fix build/test (#923) Jun 4, 2019
ImageSharp.sln Updating the repo to use Directory.Build.props/targets files (#920) Jun 1, 2019
ImageSharp.sln.DotSettings move implicit Color conversion to pixel types, May 12, 2019
LICENSE Create LICENSE Jan 16, 2018
README.md use var where apparent (#972) Aug 14, 2019
appveyor.yml Update appveyor target frameworks (64bit) Oct 24, 2018
build.cmd update version number generation system to remove gitversion Dec 20, 2017
build.ps1 Fix appveyor build Sep 1, 2018
codecov.yml DebugGuard Mar 6, 2017
run-tests.ps1 Update run-tests.ps1 to use .NETCORE2.1 Aug 23, 2018
stylecop.json add missing stylecop.json Aug 16, 2017

README.md

SixLabors.ImageSharp
SixLabors.ImageSharp

GitHub license Gitter Twitter OpenCollective OpenCollective

ImageSharp is a new, fully featured, fully managed, cross-platform, 2D graphics API.

Designed to democratize image processing, ImageSharp brings you an incredibly powerful yet beautifully simple API.

Compared to System.Drawing we have been able to develop something much more flexible, easier to code against, and much, much less prone to memory leaks. Gone are system-wide process-locks; ImageSharp images are thread-safe and fully supported in web environments.

Built against .NET Standard 1.3, ImageSharp can be used in device, cloud, and embedded/IoT scenarios.

Documentation

For all SixLabors projects, including ImageSharp: https://sixlabors.github.io/docs/

Installation

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

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

Packages

The ImageSharp library is made up of multiple packages:

  • SixLabors.ImageSharp

    • Contains the generic Image<TPixel> class, PixelFormats, Primitives, Configuration, and other core functionality
    • The IImageFormat interface, Jpeg, Png, Bmp, and Gif formats
    • Transform methods like Resize, Crop, Skew, Rotate - anything that alters the dimensions of the image
    • Non-transform methods like Gaussian Blur, Pixelate, Edge Detection - anything that maintains the original image dimensions
  • SixLabors.ImageSharp.Drawing

    • Brushes and various drawing algorithms, including drawing images
    • Various vector drawing methods for drawing paths, polygons etc.
    • Text drawing

Build Status

Build Status Code Coverage
Linux/Mac Build Status Code coverage
Windows Build Status Code coverage

Questions?

API

Our API is designed to be simple to consume. Here's an example of the code required to resize an image using the default Bicubic resampler then turn the colors into their grayscale equivalent using the BT709 standard matrix.

On platforms supporting netstandard 1.3+

using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.PixelFormats;

// Image.Load(string path) is a shortcut for our default type. 
// Other pixel formats use Image.Load<TPixel>(string path))
using (Image<Rgba32> image = Image.Load("foo.jpg"))
{
    image.Mutate(x => x
         .Resize(image.Width / 2, image.Height / 2)
         .Grayscale());
    image.Save("bar.jpg"); // Automatic encoder selected based on extension.
}

Setting individual pixel values can be performed as follows:

using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;

// Individual pixels
using (var image = new Image<Rgba32>(400, 400))
{
    image[200, 200] = Rgba32.White;
}

Rgba32 is our default PixelFormat, equivalent to System.Drawing Color. For advanced pixel format usage there are multiple PixelFormat implementations available allowing developers to implement their own color models in the same manner as Microsoft XNA Game Studio and MonoGame.

For more examples check out:

Manual build

If you prefer, you can compile ImageSharp yourself (please do and help!)

Alternatively, you can work from command line and/or with a lightweight editor on both Linux/Unix and Windows:

To clone ImageSharp locally, click the "Clone in [YOUR_OS]" button above or run the following git commands:

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

If working with Windows please ensure that you have enabled log file paths in git (run as Administrator).

git config --system core.longpaths true

Submodules

This repository contains git submodules. To add the submodules to the project, navigate to the repository root and type:

git submodule update --init --recursive

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 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]

You can’t perform that action at this time.