Code Monkey home page Code Monkey logo

imagesharp's Introduction

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.1 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;

// 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.
}

On netstandard 1.1 - 1.2

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

// 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(stream))
{
    image.Mutate(x => x
         .Resize(image.Width / 2, image.Height / 2)
         .Grayscale());
    image.Save(output);
}

Setting individual pixel values can be performed as follows:

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

// Individual pixels
using (Image<Rgba32> 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 Windows" button above or run the following git commands.

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

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]

imagesharp's People

Contributors

jimbobsquarepants avatar antonfirsov avatar tocsoft avatar iamcarbon avatar dlemstra avatar cosmo0 avatar brianpopow avatar jeavon avatar olivif avatar jbildstein avatar vpenades avatar jongleur1983 avatar woutware avatar rytmis avatar tbroust-trepia avatar rekvin avatar ullibe avatar rubensr avatar mweber26 avatar xakep139 avatar drawaes avatar denisivan0v avatar yufeih avatar mortenbock avatar georgexcollins avatar dampee avatar devedse avatar mellinoe avatar toxantron avatar voidstar69 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.