Skip to content

AlexSkarbo/ImageProcessor

 
 

Repository files navigation

ImageProcessor

This branch contains the new cross platform version of ImageProcessor.

This is a complete rewrite from the ground up to allow the processing of images without the use of System.Drawing using a cross-platform class library. It's still in early stages but progress has been pretty quick.

Build status ![Gitter](https://badges.gitter.im/Join Chat.svg)

###Why am I writing this?

With NETCore there is currently no version of System.Drawing to allow continued progress of the existing ImageProcessor library. Progress developing a cross-platform update are restricted to the CoreFXLab repo where progress seems to be very slow.

###Is this wise?

Honestly... I don't know. I could be writing code that may be suddenly obsolete. There has been little feedback on questions I've asked but it's a nice learning process if anything and I will definitely be releasing the code for consumption.

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.

Manual build

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

To install the last two please see the instructions at the DotNet documentation

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

git clone https://github.com/JimBobSquarePants/ImageProcessor

###What works so far/ What is planned?

  • Encoding/decoding of image formats (plugable)
  • jpeg (Includes progressive)
  • bmp (More bmp format saving support required, 24bit just now)
  • png (Need updating for saving indexed support)
  • gif
  • Basic color structs with implicit operators. Vector backed. #260
  • Color - Float based, premultiplied alpha, No limit to r, g, b, a values allowing for a fuller color range.
  • BGRA32
  • CIE Lab
  • CIE XYZ
  • CMYK
  • HSV
  • HSL
  • YCbCr
  • Basic shape primitives (Unfinished and could possible be updated by using Vector2, Vector3, etc)
  • Rectangle
  • Size
  • Point
  • Ellipse
  • Resampling algorithms. (Performance improvements?)
  • Box
  • Bicubic
  • Lanczos3
  • Lanczos5
  • Lanczos8
  • MitchelNetravali
  • Nearest Neighbour
  • Robidoux
  • Robidoux Sharp
  • Robidoux Soft
  • Spline
  • Triangle
  • Welch
  • Cropping
  • Rectangular Crop
  • Elliptical Crop
  • Entropy Crop
  • Rotation
  • Flip (90, 270, FlipType etc)
  • Rotate by angle
  • ColorMatrix operations (Uses Matrix4x4)
  • BlackWhite
  • Greyscale BT709
  • Greyscale BT601
  • Lomograph
  • Polaroid
  • Kodachrome
  • Sepia
  • Edge Detection
  • Kayyali
  • Kirsch
  • Laplacian3X3
  • Laplacian5X5
  • LaplacianOfGaussian
  • Prewitt
  • RobertsCross
  • Scharr
  • Sobel
  • Blurring/ Sharpening
  • Gaussian blur
  • Gaussian sharpening
  • Box Blur
  • Filters
  • Alpha
  • Contrast
  • Invert
  • BackgroundColor
  • Brightness
  • Pixelate
  • Saturation
  • Hue
  • Blend
  • Mask
  • Vignette
  • Glow
  • Effects
  • Path brush (Need help) #264
  • Pattern brush (Need help) #264
  • Elliptical brush (Need help) #264
  • Gradient brush (vignette? Need help) #264
  • Other stuff I haven't thought of.

###What might never happen

  • Exif manipulation - There's a lot of quirks in parsing EXIF and I'd need a ton of help to get it all coded. #78
  • Font support (Depends on new System.Text stuff) I don't know where to start coding this so if you have any pointers please chip in.

###API Changes

With this version the API will change dramatically. Without the constraints of System.Drawing I have been able to develop something much more flexible, easier to code against, and much, much less prone to memory leaks. Gone are using image classes which implements IDisposable, Gone are system wide proces locks with Images and processors thread safe usable in parallel processing utilizing all the availables cores.

Image methods are also fluent which allow chaining much like the ImageFactory class in V2 and below.

Here's an example of the code required to resize an image using the default Robidoux resampler then turn the colors into their greyscale equivalent using the BT709 standard matrix.

using (FileStream stream = File.OpenRead("foo.jpg"))
{
    Image image = new Image(stream);
    using (FileStream output = File.OpenWrite("bar.jpg"))
    {
        image.Resize(image.Width / 2, image.Height / 2)
             .Greyscale()
             .Save(output);
    }
}

It will also be possible to pass collections of processors as params to manipulate images. For example here I am applying a Gaussian blur with a sigma of 5 to an image, then detecting the edges using a Sobel operator working in greyscale mode.

using (FileStream stream = File.OpenRead("foo.jpg"))
{
    Image image = new Image(stream);
    using (FileStream output = File.OpenWrite("bar.jpg"))
    {
        List<IImageProcessor> processors = new List<IImageProcessor>()
        {
            new GuassianBlur(5),
            new Sobel { Greyscale = true }
        };

        image.Process(processors.ToArray())
             .Save(output);
    }
}

Individual processors can be initialised and apply processing against images. This allows nesting which will allow the powerful combination of processing methods:

new Brightness(50).Apply(sourceImage, targetImage, sourceImage.Bounds);

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. Help me set up CI for nightly releases.

Performance is a biggie, if you know anything about the new vector 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.

About

A library for on-the-fly processing of image files written in C#

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%