📷 A modern, cross-platform, 2D Graphics library for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Anton Firszov ae549a0338 re-apply DebugSave() changes after merging mutate-api 9 years ago
.github Improve issue handling [skip ci] 9 years ago
.vscode Restore Benchmark on Linux with netcoreapp1.1 9 years ago
build Fix logos [skip ci] 9 years ago
input Wyam documentation 9 years ago
samples Cleanup + Rename Run to Apply 9 years ago
src Merge remote-tracking branch 'origin/tocsoft/mutate-api' into antonfirsov/qa-lab 9 years ago
tests re-apply DebugSave() changes after merging mutate-api 9 years ago
theme Wyam documentation 9 years ago
.editorconfig generate pixel blenders 9 years ago
.gitattributes First Commit 14 years ago
.gitignore update .gitignore to match the new test output directory 9 years ago
.travis.yml Update Travis build coverity details [skip ci] 9 years ago
APACHE-2.0-LICENSE.txt Async optimisation complete. 13 years ago
CodeCoverage.runsettings Fixing indentation in runsettings. 9 years ago
ImageSharp.ruleset Use var when type is apparent 9 years ago
ImageSharp.sln merge in master 9 years ago
ImageSharp.sln.DotSettings minor JpegDecoderCore cleanup 9 years ago
ImageSharp.v2.ncrunchsolution drop PointF and use Vector2 instead 9 years ago
NuGet.config Attempt to get x-plat builds running 9 years ago
README.md Fix Appveyor link [skip ci] 9 years ago
appveyor.yml Revert key change, we have a new CI! 9 years ago
build.cmd Independently version multiple projects 9 years ago
codecov.yml DebugGuard 9 years ago
config.wyam Wyam documentation 9 years ago
features.md Update readme and features 9 years ago

README.md

ImageSharp ImageSharp

ImageSharp is a new, fully featured, fully managed, cross-platform, 2D graphics API designed to allow the processing of images without the use of System.Drawing.

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

ImageSharp has made excellent progress and contains many great features but is still considered by us to be still in early stages (alpha). As such, we cannot support its use on production environments until the library reaches release candidate status.

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

GitHub license GitHub issues GitHub stars GitHub forks Gitter Twitter OpenCollective OpenCollective

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

Installation

At present the code is pre-release but when ready it will be available on Nuget.

Pre-release downloads

We already have a MyGet package repository - for bleeding-edge / development NuGet releases.

Packages

The ImageSharp library is made up of multiple packages.

Packages include:

  • 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.
  • ImageSharp.Drawing

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

Manual build

If you prefer, you can compile ImageSharp 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

Features

There's plenty there and more coming. Check out the current features!

API

Without the constraints of 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.

Many Image<TPixel> methods are also fluent.

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.

Rgba32 is our default PixelFormat, equivalent to System.Drawing Color.

On platforms supporting netstandard 1.3+

// 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.Resize(image.Width / 2, image.Height / 2)
         .Grayscale()
         .Save("bar.jpg"); // automatic encoder selected based on extension.
}

on netstandard 1.1 - 1.2

// Image.Load(Stream stream) is a shortcut for our default type. Other pixel formats use Image.Load<TPixel>(Stream stream))
using (FileStream stream = File.OpenRead("foo.jpg"))
using (FileStream output = File.OpenWrite("bar.jpg"))
using (Image<Rgba32> image = Image.Load<Rgba32>(stream))
{
    image.Resize(image.Width / 2, image.Height / 2)
         .Grayscale()
         .Save(output);
}

Setting individual pixel values can be perfomed as follows:

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

For optimized access within a loop it is recommended that the following methods are used.

  1. image.GetRowSpan(y)
  2. image.GetRowSpan(x, y)

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.

All in all this should allow image processing to be much more accessible to developers which has always been my goal from the start.

How can you help?

Please... Spread the word, contribute algorithms, submit performance improvements, unit tests.

Performance is a biggie, if you know anything about the System.Numerics.Vectors types and can apply some fancy new stuff with that it would be awesome.

There's a lot of developers out there who could write this stuff a lot better and faster than I and I would love to see what we collectively can come up with so please, if you can help in any way it would be most welcome and benificial for all.

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]