Beta-Six Labors

Beta-Six Labors, brought to you by Dad Jokes Inc.

Beta-Six... Geddit.... Yeah, don't worry, I'm not going to give up my day job just yet.... Anyway...

ImageSharp beta 6 is available on Nuget

It's been a long time coming, (beta-6 months, I'm not sorry), but definitely well worth the wait. It's by far and away our finest release and very, very close to release candidate quality. There's been thousands of hours of development against the library to build you a best-in-class solution.

So What's New?

What isn't! There's been a lot of improvements to since beta 5.

Performance

From a performance persective a lot has happened under the hood to improve the snappiness of the library. We have:

  • Significantly sped-up our resizer by ~2.5x. On .NET Core 2.1 we now downscale images faster than System.Drawing
  • Reduced the amount of memory used during resizing by 30%. (Anton has a further cunning plan there for the release candidate)
  • Optimized the pixel conversion pipeline to ensure that all common pixel formats Rgba32, Rgb24, Bgr32, Bgr24, Argb32, Gray8, Gray16 use the fastest possible path. This means that these additional formats are all first class citizens giving you maximum flexibility.
  • Further optimized our formats to give you faster decoding/encoding (notably jpeg decoding and gif encoding)
  • Maximized our use of Span<T> and friends throughout the codebase to reduce unpooled allocations to near-zero.

There's more we can do once the System.Runtime.Intrinsics APIs are released but I can confidently say we are more than a match for other libraries on platforms where SIMD is supported.

Features

We've also added a lot of new functionality to the library.

There's a new colorspace conversion API which can convert between 14 different colorspaces.

var converter = new ColorSpaceConverter();
var hsv = new Hsv(360, 1, 1);
var rgb converter.ToRgb(hsv);  // Red 

We've added new API's for handling format specific metadata. This gives you the power to alter individual frames in a really simple manner. We actually uses these APIs internally to track meta when loading and saving an image to ensure the default encoding properties match the input.

// Load and minipulate the metadata for an animated gif frame
using(var image = Image.Load("input.gif")){
    
    var metaData = image.Frames[0].MetaData;
    GifFrameMetaData gifMeta = metaData.GetFormatMetaData(GifFormat.Instance);
    gifMeta.FrameDelay = 42;
    gifMeta.ColorTableLength = 128;
    gifMeta.DisposalMethod = GifDisposalMethod.RestoreToBackground;

    image.Save(output.gif)
}

We've added two new pixel formats - Gray8, and Gray16 which work well with the extended support we've added for png encoding. We plan on adding grayscale encoding to jpeg for the release candidate also.

The .DrawImage() API now allows you to mix and match pixels formats.

image<Rgba>.Mutate(x => x.DrawImage( Image<Argb>)

We've added two new fluent builder APIs for building affine and projective transforms. These builders automatically calculated the resultant canvas for you and rescale it accordingly to fit your new image.

// Compose a rotation plus skew transform
var affineBuilder = new AffineTransformBuilder();
affineBuilder.AppendRotationDegrees(36F)
             .AppendSkewDegrees(15F, 10F);

image.Mutate(x => x.Transform(affineBuilder));

// You can also inspect the raw matrix.
Matrix3x2 = affineBuilder.BuildMatrix(image.Size());

We've also fleshed out support for handling different subtypes within image formats. Png now supports all configurations and Bmp can decode all known good Bmp configurations.

Bug Fixes

There's new fixes added to this release (though we had relatively few reported issues from beta 5) and we've dramatically increased the number of unit tests (8280+) to ensure we don't introduce any new ones as we optimize further.

That's only a brief highlight of changes. The full changelog is available here.

Special thanks to regular contributors

  • Jason Nelson (@iamcarbon) - Code sanity, optimizations
  • Peter Wendorff @jongleur1983 - Code sanity, optimizations
  • Vicente Penades (@vpenades) - Separating Color Blending from Alpha Composition
  • Brian Popow (@brianpopow) - Better BMP support
  • Dan Manning (@dmanning23) - AOT seeding for Xamarin iOS
  • @devedse - Png metadata
  • Stephan Vedder (@feliwir) - 12 bit Jpeg support

The Release Candidate Is Coming!

There won't be a six month wait until the next release. We're very happy with the code quality of this beta and will be working hard to ship a release candidate before the end of Q1 2019.

In the interim we'll focusing on further improving memory usage and performance. I'm personally going to make a commited effort to add comprehensive documentation to cover common scenarios in addition to our API documentation. I invite anyone will and able to help out.

Licensing plans

ImageSharp and co are the culmination of over three years developmental effort made up of evenings and weekends. At SixLabors we strongly believe that we have developed a selection of products that are incredibly useful for the developer and business communities at large and as such should supported by those communities.

Donations don't pay the bills so we are embarking on a journey to license and sell a selection of our libraries.

As such, Beta 6 will be the last release we provide under Apache License. Upon releasing RC1 we will switch to a dual licensing model similar to the one provided by ServiceStack.

We are still working on the details, so nothing is for sure but what you can expect is something like this:

ImageSharp, ImageSharp.Drawing, and ImageSharp.Web will all be dual licensed under a AGPLv3/Commercial license. The AGPLv3 license will come with exceptions which allow bundling the code alongside all well known open source licenses (Apache 2.0, MIT etc). Any projects seen as direct competition (Imaging SDKs) will not be able to utilize that exception.

The commercial license will apply to anyone that chooses not to open source any code which is derived from our APIs which is a direct violation of AGPLv3. Purchasing a commercial license will give the developer the right to bundle ImageSharp with their closed source codebase.

Currently we are planning to offer the following commercial license models:

  1. A subscription license, per developer, per year with unlimited usage. This would be renewable for a maximum of 3 years before you automatically receive a perpetual license for unlimited developers and usage.

  2. A one time payment to receive an perpetual license for unlimited developers and usage.

We will offer free commercial licenses for not-for-profit organizations and cheap licenses for indie developers.

We're gonna be cheap, almost painfully so, in order to hopefully not drive away users.

If you have any questions (eg. more details about pricing plans), please contact us on our gitter channel.

comments powered by Disqus