Vali-Blob.ImageSharp
1.0.0
dotnet add package Vali-Blob.ImageSharp --version 1.0.0
NuGet\Install-Package Vali-Blob.ImageSharp -Version 1.0.0
<PackageReference Include="Vali-Blob.ImageSharp" Version="1.0.0" />
<PackageVersion Include="Vali-Blob.ImageSharp" Version="1.0.0" />
<PackageReference Include="Vali-Blob.ImageSharp" />
paket add Vali-Blob.ImageSharp --version 1.0.0
#r "nuget: Vali-Blob.ImageSharp, 1.0.0"
#:package Vali-Blob.ImageSharp@1.0.0
#addin nuget:?package=Vali-Blob.ImageSharp&version=1.0.0
#tool nuget:?package=Vali-Blob.ImageSharp&version=1.0.0
Vali-Blob.ImageSharp
Image processing middleware for Vali-Blob using SixLabors.ImageSharp.
Plugs into the Vali-Blob middleware pipeline and automatically resizes, converts, and optimizes images before they are stored via any Vali-Blob provider (AWS S3, Azure Blob, GCP, OCI, Supabase, Local). Optionally generates a thumbnail alongside the main upload — all in a single pipeline step.
Compatibility
| Target Framework | Supported |
|---|---|
net6.0 |
Yes |
net7.0 |
Yes |
net8.0 |
Yes |
net9.0 |
Yes |
Installation
dotnet add package ValiBlob.Core
dotnet add package ValiBlob.ImageSharp
Registration
using ValiBlob.Core.DependencyInjection;
using ValiBlob.AWS.Extensions;
using ValiBlob.ImageSharp.Extensions;
builder.Services
.AddValiBlob(opts => opts.DefaultProvider = "AWS")
.UseAWS()
.WithImageProcessing(opts =>
{
opts.MaxWidth = 1920;
opts.MaxHeight = 1080;
opts.JpegQuality = 85;
opts.OutputFormat = ImageOutputFormat.Jpeg;
});
With thumbnail generation
builder.Services
.AddValiBlob(opts => opts.DefaultProvider = "AWS")
.UseAWS()
.WithImageProcessing(opts =>
{
opts.MaxWidth = 2048;
opts.MaxHeight = 2048;
opts.JpegQuality = 80;
opts.OutputFormat = ImageOutputFormat.WebP;
opts.Thumbnail = new ThumbnailOptions
{
Width = 300,
Height = 300,
Suffix = "_thumb" // stored as "uploads/photo_thumb.webp"
};
});
Combined with validation
builder.Services
.AddValiBlob(opts => opts.DefaultProvider = "Azure")
.UseAzure()
.WithPipeline(p => p
.UseValidation(v =>
{
v.AllowedExtensions = new[] { ".jpg", ".jpeg", ".png", ".webp", ".gif" };
v.MaxFileSizeBytes = 20 * 1024 * 1024; // 20 MB before processing
})
)
.WithImageProcessing(opts =>
{
opts.MaxWidth = 1920;
opts.MaxHeight = 1080;
opts.JpegQuality = 82;
opts.OutputFormat = ImageOutputFormat.Jpeg;
opts.Thumbnail = new ThumbnailOptions
{
Width = 200,
Height = 200,
Suffix = "_sm"
};
});
Usage
Once registered, image processing is fully transparent — just upload normally:
public class PhotoService(IStorageProvider storage)
{
public async Task<PhotoResult> UploadPhotoAsync(IFormFile file, string userId)
{
await using var stream = file.OpenReadStream();
var result = await storage.UploadAsync(new UploadRequest
{
Path = StoragePath.From("photos", userId, file.FileName),
Content = stream,
ContentType = file.ContentType
});
if (!result.IsSuccess)
throw new Exception(result.ErrorMessage);
// Image was automatically resized + converted + thumbnail generated
return new PhotoResult
{
Url = result.Value!.Url,
ThumbnailUrl = result.Value!.ThumbnailUrl // populated when opts.Thumbnail is set
};
}
}
How the pipeline works
Client upload (original JPEG, 8 MB, 4000×3000)
│
▼
┌───────────────────────┐
│ ValidationMiddleware │ ← reject if wrong extension / too large
└───────────┬───────────┘
│
▼
┌───────────────────────┐
│ ImageSharpMiddleware │ ← resize → 1920×1080, convert → WebP, quality 80
└───────────┬───────────┘ also generates 300×300 thumbnail
│
▼
┌───────────────────────┐
│ Cloud Provider │ ← store processed image + thumbnail
└───────────────────────┘
Non-image content types (e.g. PDF, ZIP) pass through unchanged.
Supported input formats
| Format | Processed |
|---|---|
| JPEG / JPG | Yes |
| PNG | Yes |
| GIF | Yes |
| BMP | Yes |
| WebP | Yes |
| TIFF | Yes |
| Other (PDF, ZIP, etc.) | No — passed through unchanged |
Output formats
ImageOutputFormat |
Description |
|---|---|
Jpeg |
JPEG with configurable quality |
Png |
PNG (lossless) |
WebP |
WebP — best compression for web |
Original |
Keep the original format (only resize/crop) |
Options reference
| Property | Default | Description |
|---|---|---|
MaxWidth |
0 (no limit) |
Maximum output width in pixels |
MaxHeight |
0 (no limit) |
Maximum output height in pixels |
JpegQuality |
80 |
JPEG quality 1–100 (higher = better quality, larger file) |
OutputFormat |
Original |
Target output format |
ProcessableContentTypes |
image/jpeg, image/png, image/gif, image/bmp, image/webp, image/tiff |
Content types that trigger processing |
Thumbnail.Width |
— | Thumbnail width in pixels |
Thumbnail.Height |
— | Thumbnail height in pixels |
Thumbnail.Suffix |
"_thumb" |
Appended to the file name before the extension |
Aspect ratio: Images are resized with aspect-ratio preservation (fit inside
MaxWidth×MaxHeightwithout cropping). Thumbnails are cropped to fill the exactWidth×Heightspecified.
Features
| Feature | Supported |
|---|---|
| Resize with aspect-ratio preservation | Yes |
| Format conversion (JPEG, PNG, WebP) | Yes |
| JPEG quality control | Yes |
| Thumbnail generation (separate file) | Yes |
| Pass-through for non-image content | Yes |
| Configurable processable MIME types | Yes |
| Works with all Vali-Blob providers | Yes |
Documentation
Links
Donations
If Vali-Blob is useful to you, consider supporting its development:
- Latin America — MercadoPago
- International — PayPal
License
Contributions
Issues and pull requests are welcome on GitHub.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net6.0
- SixLabors.ImageSharp (>= 3.1.5)
- Vali-Blob.Core (>= 1.0.0)
-
net7.0
- SixLabors.ImageSharp (>= 3.1.5)
- Vali-Blob.Core (>= 1.0.0)
-
net8.0
- SixLabors.ImageSharp (>= 3.1.5)
- Vali-Blob.Core (>= 1.0.0)
-
net9.0
- SixLabors.ImageSharp (>= 3.1.5)
- Vali-Blob.Core (>= 1.0.0)
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 |
|---|---|---|
| 1.0.0 | 125 | 3/21/2026 |
See CHANGELOG.md at https://github.com/UBF21/Vali-Blob/blob/main/CHANGELOG.md