Soenneker.Libvips.Util 4.0.80

Prefix Reserved
dotnet add package Soenneker.Libvips.Util --version 4.0.80
                    
NuGet\Install-Package Soenneker.Libvips.Util -Version 4.0.80
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.Libvips.Util" Version="4.0.80" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Libvips.Util" Version="4.0.80" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Libvips.Util" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.Libvips.Util --version 4.0.80
                    
#r "nuget: Soenneker.Libvips.Util, 4.0.80"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.Libvips.Util@4.0.80
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Libvips.Util&version=4.0.80
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Libvips.Util&version=4.0.80
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.Libvips.Util

A cross-platform .NET API for the bundled libvips command-line distributions.

Quick start

Install the package:

dotnet add package Soenneker.Libvips.Util

Register it and convert an image:

using Microsoft.Extensions.DependencyInjection;
using Soenneker.Libvips.Util.Abstract;
using Soenneker.Libvips.Util.Registrars;

await using ServiceProvider provider = new ServiceCollection()
    .AddLogging()
    .AddLibvipsUtilAsSingleton()
    .BuildServiceProvider();

ILibvipsUtil libvips = provider.GetRequiredService<ILibvipsUtil>();

await libvips.ConvertToWebp("images/photo.jpg", "images/photo.webp");

That is all the setup required. The package includes libvips for Windows x64 and Linux x64.

Everyday operations

The output extension selects the image format.

Convert

await libvips.Convert("photo.tif", "photo.jpg");
await libvips.ConvertToAvif("photo.jpg", "photo.avif");
await libvips.ConvertToWebp("photo.jpg", "photo.webp");
await libvips.ConvertToJpeg("photo.png", "photo.jpg");
await libvips.ConvertToPng("photo.jpg", "photo.png");

Resize

await libvips.Resize("photo.jpg", "small.webp", width: 1200);
await libvips.Resize("photo.jpg", "thumbnail.webp", width: 400, height: 400);

Images are not enlarged unless you explicitly request it.

Crop

await libvips.Crop("photo.jpg", "crop.jpg", left: 20, top: 20, width: 800, height: 600);
await libvips.SmartCrop("photo.jpg", "avatar.webp", width: 512, height: 512);

Transform

using Soenneker.Libvips.Util.Enums;

await libvips.AutoRotate("phone-photo.jpg", "upright.jpg");
await libvips.Rotate("photo.jpg", "rotated.jpg", LibvipsAngle.D90);
await libvips.Flip("photo.jpg", "mirrored.jpg", LibvipsDirection.Horizontal);
await libvips.Blur("photo.jpg", "blurred.jpg", sigma: 2.5);
await libvips.Sharpen("photo.jpg", "sharpened.jpg");
await libvips.Gamma("photo.jpg", "corrected.jpg");
await libvips.Invert("photo.jpg", "inverted.jpg");
await libvips.Flatten("transparent.png", "flat.jpg", [255, 255, 255]);

Control the output

The typed conversion methods accept format-specific options:

using Soenneker.Libvips.Util.Options;

await libvips.ConvertToAvif("photo.jpg", "photo.avif", new AvifOptions
{
    Quality = 85,
    Effort = 5,
    BitDepth = 10,
    StripMetadata = true
});

await libvips.ConvertToJpeg("photo.png", "photo.jpg", new JpegOptions
{
    Quality = 88,
    Progressive = true,
    OptimizeCoding = true,
    TrellisQuantization = true
});

AvifOptions, WebpOptions, JpegOptions, PngOptions, and TiffOptions expose all saver options reported by the bundled libvips build. Common controls such as metadata retention, ICC profiles, background values, and multipage height live on LibvipsOptions.

Advanced resizing

Use ResizeOptions to control enlargement, cropping, orientation, and linear-light resizing:

using Soenneker.Libvips.Util.Enums;
using Soenneker.Libvips.Util.Options;

await libvips.Resize("photo.jpg", "cover.webp", new ResizeOptions
{
    Width = 1200,
    Height = 630,
    Size = LibvipsSize.Both,
    Crop = LibvipsInteresting.Attention,
    AutoRotate = true
});

Chain operations

A pipeline runs several operations while encoding only the final image:

using Soenneker.Libvips.Util.Pipelines;
using Soenneker.Libvips.Util.Pipelines.Abstract;

using ILibvipsPipeline pipeline = new LibvipsPipeline()
    .AutoRotate()
    .SmartCrop(1200, 630)
    .Sharpen();

await libvips.Process("photo.jpg", "social-card.avif", pipeline);

Pipelines are reusable and safe to inspect asynchronously with GetCount() and GetSteps().

Inspect an image

using Soenneker.Libvips.Util.Dtos;

ImageInfo info = await libvips.Identify("photo.jpg");

Console.WriteLine($"{info.Width}x{info.Height}");
Console.WriteLine($"{info.PixelCount} pixels");
Console.WriteLine(info.Format);

Identify also provides bands, coding, colour interpretation, resolution, loader information, and a case-insensitive metadata dictionary.

Use any libvips operation

For operations without a dedicated method, build a structured command:

using Soenneker.Libvips.Util.Commands;
using Soenneker.Libvips.Util.Commands.Abstract;

ILibvipsCommand command = new LibvipsCommand("colourspace")
    .AddArgument("input.tif")
    .AddArgument("output.jpg")
    .AddArgument("srgb");

IReadOnlyList<string> output = await libvips.Execute(command, log: false);

Prefer Execute over the raw Run method when arguments contain paths or application-supplied values.

Useful behavior

  • Missing output directories are created automatically.
  • Output is written atomically, so a failed operation does not replace an existing image.
  • Input and output may be the same path.
  • Paths containing spaces are supported.
  • Every asynchronous operation accepts a cancellation token.
  • Missing inputs throw FileNotFoundException.
  • Invalid options throw an argument exception.
  • libvips failures throw InvalidOperationException with the native error output.
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.80 0 9/15/2026
4.0.79 47 9/13/2026
4.0.76 43 9/13/2026
4.0.75 41 9/12/2026
4.0.74 48 9/12/2026
4.0.73 61 9/12/2026
4.0.71 53 9/11/2026
4.0.70 57 9/10/2026
4.0.69 52 9/10/2026
4.0.68 53 9/9/2026
4.0.67 57 9/9/2026
4.0.66 54 9/9/2026
4.0.65 44 9/9/2026
4.0.64 52 9/9/2026
4.0.63 47 9/8/2026
4.0.62 54 9/8/2026
4.0.61 66 9/8/2026
4.0.60 54 9/8/2026
4.0.59 54 9/8/2026
4.0.58 56 9/8/2026
Loading failed