NewTun.CaesiumSharp 1.0.0

dotnet add package NewTun.CaesiumSharp --version 1.0.0
                    
NuGet\Install-Package NewTun.CaesiumSharp -Version 1.0.0
                    
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="NewTun.CaesiumSharp" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NewTun.CaesiumSharp" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="NewTun.CaesiumSharp" />
                    
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 NewTun.CaesiumSharp --version 1.0.0
                    
#r "nuget: NewTun.CaesiumSharp, 1.0.0"
                    
#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 NewTun.CaesiumSharp@1.0.0
                    
#: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=NewTun.CaesiumSharp&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=NewTun.CaesiumSharp&version=1.0.0
                    
Install as a Cake Tool

NewTun.CaesiumSharp for C#

build-status last-commit license dotnet nuget

NewTun.CaesiumSharp is a powerful .NET wrapper for the Libcaesium library, providing seamless image compression and format conversion capabilities with an intuitive C# API.

Features

  • ๐Ÿš€ High Performance: Native C library integration for optimal speed
  • ๐Ÿ“ฆ Multiple Formats: Support for JPEG, PNG, GIF, WebP, and TIFF
  • ๐Ÿ”ง Fine-grained Control: Extensive compression parameters for each format
  • ๐Ÿ’พ Flexible Input/Output: File-based and in-memory compression
  • ๐ŸŽฏ Target Size Compression: Automatically compress to a specific file size
  • ๐Ÿ”„ Format Conversion: Convert between different image formats
  • ๐Ÿงน Metadata Management: Option to preserve or remove EXIF/ICC metadata
  • ๐Ÿ“ Image Resizing: Scale images while compressing
  • ๐Ÿชถ Lightweight: No external dependencies beyond the native library

Installation

Prerequisites

  • .NET 8.0 or higher

Via NuGet

dotnet add package NewTun.CaesiumSharp

Examples

  • Program.cs
static void Main(string[] args)
{
    Console.WriteLine("Hello, World!");

    List<string> paths =
    [
        @"/Downloads/1.jpg",
        @"/Downloads/2.jpg",
        @"/Downloads/3.jpg",
        @"/Downloads/4.jpg",
        @"/Downloads/5.jpg",
    ];
    
    using (var compressor = new CaesiumCompressor())
    {
        // var parameters = compressor.GetDefaultParameters();
        var parameters = new CCSParameters()
        {
            KeepMetadata = false,
            JpegQuality = 30,
            
            PngQuality = 30,
            
            GifQuality = 30,
            
            WebpQuality = 30,
        };

        foreach (var path in paths)
        {
            if (compressor.CompressFile(path, Path.Combine(Path.GetDirectoryName(path), "scaled", Path.GetFileName(path)), parameters, out string? error))
            {
                Console.WriteLine("Compression successful!");
            }
            else
            {
                Console.WriteLine($"Compression failed: {error}");
            }
        }
    }
}

License

  • This project is licensed under the MIT License - see the LICENSE file for details.

โญ Star this repository if you find it useful!

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

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 129 8/23/2026