Aspose.Imaging Image Compressor for .NET
The Aspose.Imaging Image Compressor for .NET Plugin empowers developers to efficiently reduce image file sizes across raster and vector formats while maintaining visual quality. It offers both lossless and lossy compression modes, adjustable quality settings, and flexible APIs for web optimization, archiving, or large-scale processing.
Installation
- Install the NuGet package as described in the Installation Guide .
- Configure licensing with the Metered Licensing instructions to unlock full functionality.
Example: Compressing a PNG Image
using (var image = Image.Load("sample.png"))
{
image.Save("compressed.png", new PngOptions
{
CompressionLevel = 9,
Progressive = true,
ColorType = PngColorType.IndexedColor,
Palette = ColorPaletteHelper.GetCloseImagePalette((RasterImage)image, 1 << 5)
});
}
For WebP compression, you can fine-tune parameters with WebpOptions
, setting lossless to false
and defining a quality percentage.
Key Features
Compression Modes
- Lossless: preserve all image data, perfect for editing and archiving.
- Lossy: achieve maximum reduction with perceptual models and quantization.
Quality and Profiles
- Adjustable quality (0–100) with support for chroma subsampling and smoothing.
- Define reusable compression profiles for consistency across projects.
Multi-Format Support
- Compress JPEG, PNG, WebP, GIF, and TIFF images.
- Automatic format detection with options to override on save.
Batch and Performance
- Queue-based API for bulk processing.
- Throttling, async/await APIs, and memory tuning for large workloads.
- Thread-safe design with logging hooks for monitoring compression ratios and performance.
Metadata Control
- Preserve or strip EXIF, XMP, and ICC profiles.
- Automatically drop unnecessary metadata for reduced size and privacy protection.
Integration and Flexibility
- Stream and file-based APIs for desktop, web, or microservices.
- Works seamlessly with .NET Core, .NET 5+, and .NET Framework.
- Directly integrates into existing Aspose.Imaging pipelines.
Free Online Image Compression
Try the Aspose.Imaging Free Online Image Compressor to experience features instantly without installation or coding.
Tips and Best Practices
- Start with quality between 75–85 for a good balance of size and fidelity.
- Use lossless for editable content; lossy for final delivery.
- Strip metadata before public distribution.
- Batch compress in chunks and monitor memory usage.
- Log compression statistics to track performance and size savings.
Conclusion
The Aspose.Imaging Image Compressor for .NET Plugin is a high-performance solution for developers who need to compress images in C# while maintaining quality. With support for multiple formats, batch workflows, and flexible profiles, it is ideal for web optimization and large-scale image processing. Unlock the full version for just $99 and streamline your .NET image compression today.