Image processing in .NET without native dependencies

 
 
  • Gérald Barré

In this post, we'll explore Meziantou.Framework.Imaging. This package, under MIT license, allows you to read, write, process, and draw images in .NET, with code written entirely in C#.

In one sentence: more than 20 image formats, including the AVIF and HEIC photos of phones and JPEG XL, more than 60 processing operations, drawing, text in any script, and color management, in a single package with no native dependency. And it's fast! The benchmarks at the end of this post compare it with ImageSharp and SkiaSharp.

Image processing in .NET usually means a compromise. SkiaSharp and Magick.NET wrap native libraries, whose binaries must match the operating system and the processor of every machine you deploy to. ImageSharp is fully managed, but it is not free for every project, and it doesn't read AVIF or HEIC files at the time of writing. Meziantou.Framework.Imaging, under MIT license, implements every codec in C#, including the AV1 and HEVC codecs behind AVIF and HEIC. The same package runs on Windows, Linux, and macOS, on x64 and ARM64, and in trimmed and Native AOT applications.

This post is an overview of the package, with a few samples and the images they produce. Every image of this post was drawn by these samples.

#What it can do

  • Read and write more than 20 formats: PNG and APNG, JPEG, GIF, WebP, AVIF, HEIC, JPEG XL, JPEG 2000, TIFF, BMP, TGA, QOI, Netpbm, ICO and CUR, PSD, OpenEXR, Radiance HDR, DDS and KTX 2.0 textures, DPX… The format is detected from the content of the file, not from its extension.
  • Animations: GIF, APNG, WebP, AVIF, HEIC, and JPEG XL animations load as full frames with their exact durations, and every operation applies to all the frames. Streaming readers and writers process long animations one frame at a time.
  • Processing: resize, crop to the content, rotate, correct a perspective, blur, sharpen, detect edges, adjust the colors, the levels, and the curves, reduce to a palette, remove scratches, resize without distorting the content (seam carving), add a watermark, and more.
  • Drawing: shapes, paths, SVG path data, gradients, patterns, shadows, masks, and layers, with antialiasing.
  • Text: TrueType, OpenType, WOFF, and WOFF2 fonts, paragraphs, right-to-left and vertical text, and the complex scripts, such as Arabic and Hindi, with fallback fonts.
  • Color and metadata: EXIF, XMP, and ICC profiles are kept, the orientation of photos is applied on request, and colors are converted between ICC profiles, CMYK included.
  • Untrusted files: limits on the memory, the size, and the number of frames protect your application from hostile files.
  • Same input, same pixels: decoding, processing, and drawing give the same pixels on every platform, which makes the output testable.

#Installation

Shell
dotnet package add Meziantou.Framework.Imaging

The images, loading, and processing are in the Meziantou.Framework.Imaging namespace, the encoders in Meziantou.Framework.Imaging.Formats, the canvas in Meziantou.Framework.Imaging.Drawing, and the text in Meziantou.Framework.Imaging.Typography.

#Converting and resizing

The most common task takes three lines. Image.Load detects the format from the content of the file, Resize keeps the aspect ratio by default, and the encoder selects the output format:

C#
using var image = Image.Load("photo.heic"); // The photo of a phone
image.Resize(new ResizeOptions(1200, 1200)); // Fits in 1200x1200 and keeps the aspect ratio
image.Save("photo.webp", new WebPEncoder { Compression = WebPCompression.Lossy, Quality = 80 });

The package is strict: it never loses something silently. Saving an image with transparent pixels as JPEG, a 16-bit image to an 8-bit format, or an animation to a format that stores one picture throws an UnsupportedImageFeatureException that says what to set, instead of writing a different image.

#Drawing

The sample image of this post is drawn with the canvas: a linear gradient for the sky, a radial gradient for the sun, and two paths for the mountains:

C#
using var image = new Image<Rgba32>(640, 360);
var sky = new LinearGradientBrush(new PointD(0, 0), new PointD(0, 260), [
    new GradientStop(0, Rgba32.ParseHex("#1E3C72")),
    new GradientStop(0.6, Rgba32.ParseHex("#E96443")),
    new GradientStop(1, Rgba32.ParseHex("#FFD194"))]);
var sun = new RadialGradientBrush(new PointD(440, 200), 70, [
    new GradientStop(0, Rgba32.ParseHex("#FFF6D5")),
    new GradientStop(0.5, Rgba32.ParseHex("#FFC65C")),
    new GradientStop(1, new Rgba32(255, 198, 92, 0))]);
var mountains = new VectorPathBuilder()
    .MoveTo(new PointD(0, 250)).LineTo(new PointD(120, 150)).LineTo(new PointD(220, 220))
    .LineTo(new PointD(340, 120)).LineTo(new PointD(470, 230)).LineTo(new PointD(560, 170))
    .LineTo(new PointD(640, 220)).LineTo(new PointD(640, 360)).LineTo(new PointD(0, 360))
    .Close().Build();

image.Draw(canvas =>
{
    canvas.Fill(sky);
    canvas.FillCircle(sun, new PointD(440, 200), 70);
    canvas.Fill(Rgba32.ParseHex("#5B3A6E"), mountains);
    // The closer mountains are another path, with a darker color
});

image.Save("landscape.png");

A landscape at sunset: a sky going from blue to orange, a sun, and two rows of mountainslandscape.png

#Processing

Each operation is a method that changes the image in place, for all its frames:

C#
using var image = Image.Load("landscape.png");
image.GaussianBlur(4);

// Some other operations:
// image.Grayscale();
// image.Pixelate(16);
// image.OilPaint(4, 16);
// image.DetectEdges(EdgeDetector.Sobel);
// image.Quantize(new QuantizeOptions { MaxColors = 8 });
// image.Rotate(15);

image.Save("blurred.png");

Here is the result of these operations on the landscape:

The landscape with eight effects: original, grayscale, Gaussian blur, pixelate, oil paint, edge detection, quantization to 8 colors, and a rotation of 15 degreesThe same image with 8 processing operations

#Text in any script

Text is drawn from font files, which you load once and share. A FontStack draws each character with the first font that has it, and the text engine orders the right-to-left text and shapes the complex scripts. Here is a card for social media, with an image resized and drawn on it:

C#
var font = Font.Load("NotoSans-Regular.ttf");
var fonts = new FontStack(font, Font.Load("NotoNaskhArabic-Regular.ttf"), Font.Load("NotoSansDevanagari-Regular.ttf"));
var title = TextLayout.Create("Image processing in .NET", new TextStyle(fonts, 72));
var subtitle = TextLayout.Create("Hello, مرحبا, नमस्ते", new TextStyle(fonts, 44));
var badgeText = TextLayout.Create("Meziantou.Framework.Imaging", font, size: 32);
var background = new LinearGradientBrush(new PointD(0, 0), new PointD(1200, 630), [
    new GradientStop(0, Rgba32.ParseHex("#0F2027")),
    new GradientStop(1, Rgba32.ParseHex("#2C5364"))]);

using var landscape = Image.Load<Rgba32>("landscape.png");
landscape.Resize(new ResizeOptions(400, 225));

using var card = new Image<Rgba32>(1200, 630);
card.Draw(canvas =>
{
    canvas.FillRectangle(background, new RectangleD(0, 0, 1200, 630));
    canvas.FillText(Colors.White, title, new PointD(80, 120));
    canvas.FillText(Rgba32.ParseHex("#FFD194"), subtitle, new PointD(80, 240));

    var badge = new RectangleD(80, 420, 520, 80);
    canvas.FillRoundedRectangle(new Rgba32(255, 255, 255, 40), badge, 16);
    canvas.FillText(Colors.White, badgeText, badgeText.GetOrigin(badge, TextHorizontalAnchor.Center, TextVerticalAnchor.Center, TextBounds.Ink));

    canvas.DrawImage(landscape.Frames[0], new PointD(720, 330), 1);
});

card.Save("card.png");

A card with the title "Image processing in .NET", a greeting in English, Arabic, and Hindi, a badge with the name of the package, and the landscapecard.png: the Arabic word is joined and written from right to left, and the Hindi word uses a conjunct

The output doesn't depend on the fonts installed on the machine: you get the same pixels on a developer machine and in a container.

#Choosing a format

The newer formats compress much better than JPEG. Here is the landscape saved in several formats, with the size of the file and its SSIMULACRA 2 score, a metric of the visual quality computed by ImageSimilarity.ComputeSsimulacra2 (100 for identical pixels, about 90 when the difference is not visible):

FormatSizeSSIMULACRA 2
PNG14,795 bytes100
JPEG, quality 8512,974 bytes84.3
WebP, lossy, quality 803,728 bytes79.4
AVIF, lossy, quality 602,964 bytes86.4
HEIC, lossy, quality 604,063 bytes89.8
JPEG XL, lossy (default quality, 75)4,748 bytes87.5
JPEG XL, lossless10,115 bytes100

This image has large areas of smooth color, which every format compresses well, so the sizes of a photo are larger and the differences between formats vary. JPEG XL has another feature: it recompresses an existing JPEG file without decoding its pixels, and gives back the original file byte for byte.

The encoders are also strict about color. OpenEXR and Radiance HDR store linear light: saving this sRGB image as .exr throws an exception that asks you to convert the samples first, instead of writing a file with the wrong colors.

#Untrusted files

A small file can describe a huge image, or thousands of frames. When you process files uploaded by users, set the limits of the configuration: the library checks them before allocating the pixels, and throws an ImageResourceLimitException:

C#
var configuration = new ImageConfiguration
{
    Limits = new ImageResourceLimits { MaxLiveAllocationBytes = 64 * 1024 * 1024 },
};

using var image = Image.Load("upload.jpg", new ImageDecodeOptions { Configuration = configuration });

The decoders are also tested against malformed files: a corrupted file throws an InvalidImageContentException, an unknown format an UnknownImageFormatException, and a feature the codec doesn't support an UnsupportedImageFeatureException, so you can tell the user what is wrong.

#Performance

A managed library doesn't have to be slow. I compared Meziantou.Framework.Imaging 1.2.20 with SixLabors.ImageSharp 4.1.4 and SkiaSharp 4.158.0, the latest versions when writing this post, on .NET 10, with BenchmarkDotNet. The machines are an AMD Ryzen 9 9900X running Windows 11 (x64) and an Apple M5 Pro running macOS (ARM64), and the images have 1920x1080 and 4000x3000 pixels (FullHd and Photo12MP). Meziantou.Framework.Imaging is the baseline: a ratio above 1 means that the other library is slower.

Each operation runs on one thread (Parallel is False), and with MaxDegreeOfParallelism set to the number of logical processors (True). One thread is the default of Meziantou.Framework.Imaging, and all the processors is the default of ImageSharp. SkiaSharp has no such option, so the tables only show it once, with Parallel set to False: compare the True rows with it too. The ratios are computed against Meziantou.Framework.Imaging with the same value of Parallel. The resize isn't the same work in every library, for Resize and for Thumbnail: SkiaSharp uses bilinear filtering with mipmaps, which reads fewer pixels than the Catmull-Rom filter of the other libraries. It is cheaper, but the result is slightly softer and has more aliasing. DecodeJpegToSrgb decodes a JPEG file tagged with a Display P3 profile and converts its pixels to sRGB. Allocated only counts managed memory, so it doesn't include the native memory of SkiaSharp.

MethodSizeParallelMeanErrorStdDevRatioAllocated
Meziantou_DecodePngFullHdFalse9.466 ms0.128 ms0.120 ms1.004694 B
ImageSharp_DecodePngFullHdFalse11.290 ms0.048 ms0.040 ms1.1930285 B
Skia_DecodePngFullHdFalse11.114 ms0.127 ms0.119 ms1.17296 B
Meziantou_DecodePngFullHdTrue9.539 ms0.131 ms0.122 ms1.004694 B
ImageSharp_DecodePngFullHdTrue11.344 ms0.159 ms0.149 ms1.1930285 B
Meziantou_DecodePngPhoto12MPFalse58.256 ms0.810 ms0.718 ms1.005326 B
ImageSharp_DecodePngPhoto12MPFalse66.692 ms0.994 ms0.930 ms1.14157069 B
Skia_DecodePngPhoto12MPFalse65.413 ms0.840 ms0.786 ms1.12296 B
Meziantou_DecodePngPhoto12MPTrue58.712 ms0.820 ms0.767 ms1.005326 B
ImageSharp_DecodePngPhoto12MPTrue67.504 ms0.757 ms0.671 ms1.15157069 B
Meziantou_DecodeJpegFullHdFalse2.728 ms0.001 ms0.001 ms1.0032023 B
ImageSharp_DecodeJpegFullHdFalse3.926 ms0.013 ms0.010 ms1.4416695 B
Skia_DecodeJpegFullHdFalse6.990 ms0.037 ms0.031 ms2.56296 B
Meziantou_DecodeJpegFullHdTrue2.433 ms0.018 ms0.018 ms1.00150805 B
ImageSharp_DecodeJpegFullHdTrue3.906 ms0.036 ms0.034 ms1.6116600 B
Meziantou_DecodeJpegPhoto12MPFalse15.078 ms0.074 ms0.069 ms1.0032498 B
ImageSharp_DecodeJpegPhoto12MPFalse23.072 ms0.112 ms0.093 ms1.5317328 B
Skia_DecodeJpegPhoto12MPFalse39.396 ms0.269 ms0.225 ms2.61296 B
Meziantou_DecodeJpegPhoto12MPTrue12.942 ms0.067 ms0.056 ms1.0012518738 B
ImageSharp_DecodeJpegPhoto12MPTrue23.277 ms0.423 ms0.396 ms1.8017328 B
Meziantou_DecodeJpegToSrgbFullHdFalse17.394 ms0.032 ms0.027 ms1.00114894 B
ImageSharp_DecodeJpegToSrgbFullHdFalse190.170 ms2.196 ms2.054 ms10.932233963 B
Skia_DecodeJpegToSrgbFullHdFalse11.746 ms0.223 ms0.219 ms0.68368 B
Meziantou_DecodeJpegToSrgbFullHdTrue5.332 ms0.030 ms0.028 ms1.00240448 B
ImageSharp_DecodeJpegToSrgbFullHdTrue181.180 ms2.369 ms2.216 ms33.982233963 B
Meziantou_DecodeJpegToSrgbPhoto12MPFalse77.527 ms0.727 ms0.607 ms1.006931776 B
ImageSharp_DecodeJpegToSrgbPhoto12MPFalse1,110.239 ms15.685 ms14.672 ms14.326169848 B
Skia_DecodeJpegToSrgbPhoto12MPFalse66.451 ms1.281 ms1.316 ms0.86368 B
Meziantou_DecodeJpegToSrgbPhoto12MPTrue20.977 ms0.105 ms0.098 ms1.0040416844 B
ImageSharp_DecodeJpegToSrgbPhoto12MPTrue1,029.942 ms20.435 ms19.115 ms49.106169848 B
Meziantou_ResizeFullHdFalse1.621 ms0.014 ms0.013 ms1.004065 B
ImageSharp_ResizeFullHdFalse1.981 ms0.016 ms0.015 ms1.2214808 B
Skia_ResizeFullHdFalse1.594 ms0.031 ms0.029 ms0.98304 B
Meziantou_ResizeFullHdTrue1.594 ms0.016 ms0.015 ms1.004065 B
ImageSharp_ResizeFullHdTrue2.052 ms0.016 ms0.015 ms1.2914808 B
Meziantou_ResizePhoto12MPFalse8.578 ms0.055 ms0.051 ms1.004520 B
ImageSharp_ResizePhoto12MPFalse11.244 ms0.060 ms0.056 ms1.3117432 B
Skia_ResizePhoto12MPFalse5.739 ms0.114 ms0.178 ms0.67304 B
Meziantou_ResizePhoto12MPTrue2.662 ms0.019 ms0.016 ms1.008759 B
ImageSharp_ResizePhoto12MPTrue11.150 ms0.080 ms0.075 ms4.1917437 B
Meziantou_EncodePngFullHdFalse37.344 ms0.376 ms0.314 ms1.004135684 B
ImageSharp_EncodePngFullHdFalse161.737 ms0.439 ms0.342 ms4.339969424 B
Skia_EncodePngFullHdFalse90.456 ms0.816 ms0.763 ms2.424222288 B
Meziantou_EncodePngFullHdTrue37.820 ms0.528 ms0.494 ms1.004135684 B
ImageSharp_EncodePngFullHdTrue162.876 ms1.909 ms1.786 ms4.319969424 B
Meziantou_EncodePngPhoto12MPFalse222.641 ms2.062 ms1.722 ms1.0033521464 B
ImageSharp_EncodePngPhoto12MPFalse969.936 ms5.184 ms4.849 ms4.3676863088 B
Skia_EncodePngPhoto12MPFalse556.104 ms8.969 ms8.390 ms2.5033829784 B
Meziantou_EncodePngPhoto12MPTrue222.937 ms2.674 ms2.501 ms1.0033521464 B
ImageSharp_EncodePngPhoto12MPTrue974.782 ms8.157 ms7.630 ms4.3776863088 B
Meziantou_EncodeJpegFullHdFalse2.853 ms0.011 ms0.009 ms1.001002849 B
ImageSharp_EncodeJpegFullHdFalse6.356 ms0.088 ms0.082 ms2.231064240 B
Skia_EncodeJpegFullHdFalse17.158 ms0.293 ms0.274 ms6.01523776 B
Meziantou_EncodeJpegFullHdTrue1.805 ms0.014 ms0.013 ms1.001334661 B
ImageSharp_EncodeJpegFullHdTrue6.375 ms0.061 ms0.057 ms3.531064240 B
Meziantou_EncodeJpegPhoto12MPFalse16.659 ms0.091 ms0.085 ms1.004157160 B
ImageSharp_EncodeJpegPhoto12MPFalse36.616 ms0.676 ms0.633 ms2.204210016 B
Skia_EncodeJpegPhoto12MPFalse98.004 ms0.857 ms0.802 ms5.884193864 B
Meziantou_EncodeJpegPhoto12MPTrue9.677 ms0.057 ms0.053 ms1.0023224086 B
ImageSharp_EncodeJpegPhoto12MPTrue39.261 ms0.065 ms0.061 ms4.064210016 B
Meziantou_ThumbnailFullHdFalse2.810 ms0.034 ms0.031 ms1.0099973 B
ImageSharp_ThumbnailFullHdFalse4.730 ms0.047 ms0.044 ms1.6891560 B
Skia_ThumbnailFullHdFalse3.894 ms0.077 ms0.102 ms1.3944088 B
Meziantou_ThumbnailFullHdTrue2.521 ms0.033 ms0.029 ms1.00129434 B
ImageSharp_ThumbnailFullHdTrue4.754 ms0.060 ms0.056 ms1.8991560 B
Meziantou_ThumbnailPhoto12MPFalse12.088 ms0.199 ms0.186 ms1.00109658 B
ImageSharp_ThumbnailPhoto12MPFalse15.479 ms0.146 ms0.137 ms1.2895168 B
Skia_ThumbnailPhoto12MPFalse11.857 ms0.127 ms0.112 ms0.9846368 B
Meziantou_ThumbnailPhoto12MPTrue11.162 ms0.166 ms0.155 ms1.00169675 B
ImageSharp_ThumbnailPhoto12MPTrue15.453 ms0.212 ms0.198 ms1.3895168 B
AMD Ryzen 9 9900X, Windows 11, .NET 10.0.15, x64
MethodSizeParallelMeanErrorStdDevRatioAllocated
Meziantou_DecodePngFullHdFalse9.136 ms0.029 ms0.027 ms1.004710 B
ImageSharp_DecodePngFullHdFalse13.371 ms0.062 ms0.058 ms1.4630285 B
Skia_DecodePngFullHdFalse10.149 ms0.072 ms0.068 ms1.11296 B
Meziantou_DecodePngFullHdTrue9.111 ms0.019 ms0.018 ms1.004710 B
ImageSharp_DecodePngFullHdTrue12.967 ms0.020 ms0.018 ms1.4230285 B
Meziantou_DecodePngPhoto12MPFalse67.210 ms0.141 ms0.125 ms1.005342 B
ImageSharp_DecodePngPhoto12MPFalse81.978 ms0.210 ms0.186 ms1.22157102 B
Skia_DecodePngPhoto12MPFalse60.331 ms0.229 ms0.214 ms0.90296 B
Meziantou_DecodePngPhoto12MPTrue67.107 ms0.270 ms0.253 ms1.005342 B
ImageSharp_DecodePngPhoto12MPTrue82.038 ms0.306 ms0.287 ms1.22157102 B
Meziantou_DecodeJpegFullHdFalse3.417 ms0.016 ms0.014 ms1.0030431 B
ImageSharp_DecodeJpegFullHdFalse6.049 ms0.051 ms0.047 ms1.7716600 B
Skia_DecodeJpegFullHdFalse2.529 ms0.014 ms0.013 ms0.74296 B
Meziantou_DecodeJpegFullHdTrue2.227 ms0.044 ms0.064 ms1.0075869 B
ImageSharp_DecodeJpegFullHdTrue6.315 ms0.126 ms0.243 ms2.8416600 B
Meziantou_DecodeJpegPhoto12MPFalse19.778 ms0.309 ms0.258 ms1.0030932 B
ImageSharp_DecodeJpegPhoto12MPFalse36.181 ms0.558 ms0.522 ms1.8317328 B
Skia_DecodeJpegPhoto12MPFalse15.131 ms0.071 ms0.059 ms0.77300 B
Meziantou_DecodeJpegPhoto12MPTrue12.061 ms0.204 ms0.181 ms1.0096921 B
ImageSharp_DecodeJpegPhoto12MPTrue35.608 ms0.240 ms0.224 ms2.9517328 B
Meziantou_DecodeJpegToSrgbFullHdFalse14.643 ms0.223 ms0.209 ms1.00113274 B
ImageSharp_DecodeJpegToSrgbFullHdFalse106.720 ms0.464 ms0.434 ms7.292234002 B
Skia_DecodeJpegToSrgbFullHdFalse15.914 ms0.306 ms0.286 ms1.09368 B
Meziantou_DecodeJpegToSrgbFullHdTrue4.496 ms0.090 ms0.177 ms1.00163639 B
ImageSharp_DecodeJpegToSrgbFullHdTrue109.453 ms1.598 ms1.495 ms24.352234002 B
Meziantou_DecodeJpegToSrgbPhoto12MPFalse74.916 ms1.064 ms0.943 ms1.006930184 B
ImageSharp_DecodeJpegToSrgbPhoto12MPFalse621.450 ms2.397 ms2.242 ms8.306169848 B
Skia_DecodeJpegToSrgbPhoto12MPFalse93.585 ms0.312 ms0.292 ms1.25368 B
Meziantou_DecodeJpegToSrgbPhoto12MPTrue18.040 ms0.107 ms0.089 ms1.0023785937 B
ImageSharp_DecodeJpegToSrgbPhoto12MPTrue631.561 ms8.985 ms7.965 ms35.016169848 B
Meziantou_ResizeFullHdFalse3.753 ms0.005 ms0.004 ms1.004082 B
ImageSharp_ResizeFullHdFalse3.526 ms0.014 ms0.013 ms0.9440408 B
Skia_ResizeFullHdFalse0.673 ms0.001 ms0.001 ms0.18304 B
Meziantou_ResizeFullHdTrue3.656 ms0.073 ms0.102 ms1.004082 B
ImageSharp_ResizeFullHdTrue3.563 ms0.043 ms0.036 ms0.9740408 B
Meziantou_ResizePhoto12MPFalse17.446 ms0.187 ms0.175 ms1.004545 B
ImageSharp_ResizePhoto12MPFalse17.581 ms0.012 ms0.011 ms1.0151672 B
Skia_ResizePhoto12MPFalse2.039 ms0.014 ms0.012 ms0.12304 B
Meziantou_ResizePhoto12MPTrue4.014 ms0.029 ms0.027 ms1.009025 B
ImageSharp_ResizePhoto12MPTrue17.618 ms0.017 ms0.015 ms4.3951672 B
Meziantou_EncodePngFullHdFalse28.204 ms0.050 ms0.047 ms1.004135672 B
ImageSharp_EncodePngFullHdFalse126.095 ms0.352 ms0.312 ms4.479969424 B
Skia_EncodePngFullHdFalse79.456 ms1.566 ms1.609 ms2.824222288 B
Meziantou_EncodePngFullHdTrue28.052 ms0.041 ms0.037 ms1.004135672 B
ImageSharp_EncodePngFullHdTrue121.912 ms0.385 ms0.360 ms4.359969424 B
Meziantou_EncodePngPhoto12MPFalse163.263 ms0.311 ms0.275 ms1.0033521430 B
ImageSharp_EncodePngPhoto12MPFalse726.809 ms0.897 ms0.839 ms4.4576863088 B
Skia_EncodePngPhoto12MPFalse459.596 ms0.829 ms0.647 ms2.8233829784 B
Meziantou_EncodePngPhoto12MPTrue164.234 ms0.457 ms0.405 ms1.0033521430 B
ImageSharp_EncodePngPhoto12MPTrue743.553 ms14.514 ms19.376 ms4.5376863088 B
Meziantou_EncodeJpegFullHdFalse4.796 ms0.007 ms0.006 ms1.001002848 B
ImageSharp_EncodeJpegFullHdFalse8.780 ms0.022 ms0.019 ms1.831064240 B
Skia_EncodeJpegFullHdFalse6.272 ms0.019 ms0.017 ms1.31523776 B
Meziantou_EncodeJpegFullHdTrue1.907 ms0.003 ms0.003 ms1.001028726 B
ImageSharp_EncodeJpegFullHdTrue8.778 ms0.012 ms0.010 ms4.601064240 B
Meziantou_EncodeJpegPhoto12MPFalse27.481 ms0.021 ms0.018 ms1.004157168 B
ImageSharp_EncodeJpegPhoto12MPFalse51.900 ms0.091 ms0.085 ms1.894210016 B
Skia_EncodeJpegPhoto12MPFalse37.114 ms0.071 ms0.067 ms1.354193864 B
Meziantou_EncodeJpegPhoto12MPTrue9.626 ms0.017 ms0.015 ms1.0015712690 B
ImageSharp_EncodeJpegPhoto12MPTrue51.293 ms0.088 ms0.078 ms5.334210016 B
Meziantou_ThumbnailFullHdFalse2.210 ms0.004 ms0.004 ms1.0098442 B
ImageSharp_ThumbnailFullHdFalse5.616 ms0.064 ms0.053 ms2.54117160 B
Skia_ThumbnailFullHdFalse2.322 ms0.007 ms0.006 ms1.0544096 B
Meziantou_ThumbnailFullHdTrue2.442 ms0.047 ms0.044 ms1.00130884 B
ImageSharp_ThumbnailFullHdTrue5.593 ms0.028 ms0.024 ms2.29117160 B
Meziantou_ThumbnailPhoto12MPFalse9.327 ms0.019 ms0.017 ms1.00108074 B
ImageSharp_ThumbnailPhoto12MPFalse19.553 ms0.019 ms0.016 ms2.10129408 B
Skia_ThumbnailPhoto12MPFalse9.613 ms0.012 ms0.010 ms1.0346368 B
Meziantou_ThumbnailPhoto12MPTrue9.614 ms0.028 ms0.023 ms1.00172635 B
ImageSharp_ThumbnailPhoto12MPTrue19.363 ms0.032 ms0.029 ms2.01129408 B
Apple M5 Pro, macOS, .NET 10.0.14, ARM64

You can download the benchmark project to run it on your machine.

#Additional resources

This post is part of the series 'Exploring Meziantou.Framework'. Be sure to check out the rest of the blog posts of the series!

Show the 18 posts of the series

Do you have a question or a suggestion about this post? Contact me!

Follow me:
Enjoy this blog?