PommaLabs.Thumbnailer.Client 6.1.1

Thumbnailer Client for .NET

License: MIT Donate Docs NuGet version NuGet downloads

standard-readme compliant GitLab pipeline status Quality gate Code coverage Renovate enabled

A .NET client for Thumbnailer, which wraps v2 endpoints under an easy to use interface.

Table of Contents

Install

NuGet package PommaLabs.Thumbnailer.Client is available for download:

dotnet add package PommaLabs.Thumbnailer.Client

Usage

Client wraps the job-based logic of v2 endpoints under a simpler interface, which hides the details of Thumbnailer jobs and exposes high-level operations such as media optimization and thumbnail generation.

When using dependency injection, client can be registered and configured using following extension method:

using Microsoft.Extensions.DependencyInjection;
using PommaLabs.Thumbnailer.Client;

services.Configure<ThumbnailerClientConfiguration>(Configuration.GetSection("Thumbnailer"));
services.AddThumbnailerClient();

After that, client will be available as an instance of IThumbnailerClient. Client can also be created by instancing following class, providing required objects such as client configuration and a logger:

using PommaLabs.Thumbnailer.Client;
using PommaLabs.Thumbnailer.Client.Services.Clients;

IThumbnailerClient thumbnailerClient = new ConcreteThumbnailerClient(clientConfiguration, logger);

Media optimization can be invoked with following methods:

var optimizedMediaBytes = await thumbnailerClient.OptimizeMediaAsync(
  fileContents, optionalContentType, optionalFileName, optionalCancellationToken);

var optimizedMediaBytes = await thumbnailerClient.OptimizeMediaAsync(
  fileUri, optionalCancellationToken);

Thumbnail generation can be invoked with following methods:

var thumbnailBytes = await thumbnailerClient.GenerateThumbnailAsync(
  fileContents, optionalContentType, optionalFileName,
  /* Thumbnail generation parameters... */, optionalCancellationToken);

var thumbnailBytes = await thumbnailerClient.GenerateThumbnailAsync(
  fileUri, /* Thumbnail generation parameters... */, optionalCancellationToken);

Maintainers

@pomma89.

Contributing

MRs accepted.

Small note: If editing the README, please conform to the standard-readme specification.

Contributors

@AlessioGiacobbe implemented new client methods to access image placeholder generation endpoints, which rely on BlurHash and ThumbHash algorithms.

Editing

Visual Studio Code, with Remote Containers extension, is the recommended way to work on this project.

A development container has been configured with all required tools.

Visual Studio Community is also supported and an updated solution file, thumbnailer-dotnet-client.sln, has been provided.

Restoring dependencies

When opening the development container, dependencies should be automatically restored.

Anyway, dependencies can be restored with following command:

dotnet restore

Running tests

Tests can be run with following command:

dotnet test

Tests can also be run with following command, which collects coverage information:

./build.sh --target run-tests

License

MIT © 2019-2023 PommaLabs Team and Contributors

No packages depend on PommaLabs.Thumbnailer.Client.

https://gitlab.com/pommalabs/thumbnailer/thumbnailer-dotnet-client/-/releases

Version Downloads Last updated
6.3.3 11 05/23/2025
6.3.2 9 05/17/2025
6.3.1 12 03/30/2025
6.3.0 12 03/31/2025
6.2.1 25 01/10/2025
6.2.0 23 01/10/2025
6.1.3 27 04/11/2024
6.1.2 27 02/07/2024
6.1.1 26 02/07/2024
6.1.0 24 02/07/2024
6.0.0 25 02/07/2024
5.1.0 16 02/07/2024
5.0.0 20 02/07/2024
4.2.0 54 03/31/2022
4.1.0 20 02/07/2024
4.0.2 61 10/04/2021
3.1.0 102 02/07/2021
3.0.0 103 11/09/2020
2.1.0 38 09/14/2020
2.0.2 42 07/04/2020
2.0.1 25 02/07/2024
2.0.0 23 02/07/2024
1.7.1 26 02/07/2024
1.6.3 25 02/07/2024
1.6.0 19 02/07/2024
1.3.0 51 02/10/2020