PeachImage 0.1.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package PeachImage --version 0.1.2
                    
NuGet\Install-Package PeachImage -Version 0.1.2
                    
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="PeachImage" Version="0.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PeachImage" Version="0.1.2" />
                    
Directory.Packages.props
<PackageReference Include="PeachImage" />
                    
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 PeachImage --version 0.1.2
                    
#r "nuget: PeachImage, 0.1.2"
                    
#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 PeachImage@0.1.2
                    
#: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=PeachImage&version=0.1.2
                    
Install as a Cake Addin
#tool nuget:?package=PeachImage&version=0.1.2
                    
Install as a Cake Tool

PeachImage

Pure .NET image format readers and writers for commonly used image formats on the web.

Targets .NET 10. No native interop — every codec is managed code, using modern .NET APIs (System.Runtime.Intrinsics, Span<T>/ReadOnlySpan<T>) for performance instead of P/Invoke.

Status

  • JPEG: decode (baseline sequential + progressive, grayscale/YCbCr/RGB/CMYK/YCCK, all standard chroma subsampling, restart markers) and encode (baseline sequential, grayscale/YCbCr) are implemented. SIMD-accelerated IDCT/FDCT and color conversion kernels are in place (System.Runtime.Intrinsics.Vector128/Vector256, dispatched at runtime by hardware support).
  • BMP: decode (OS/2 1.x/2.x and Windows BITMAPINFOHEADER through BITMAPV5HEADER variants, 1/4/8bpp indexed color, 16/24/32bpp direct color, RLE4/RLE8 compression, arbitrary BI_BITFIELDS/BI_ALPHABITFIELDS masks) and encode (24bpp truecolor, 8bpp indexed grayscale with optional RLE8, 32bpp with an explicit alpha channel via BITMAPV4HEADER + BI_BITFIELDS) are implemented, including explicit alpha-channel support on both sides.
  • PNG: decode and encode for all 5 color types (grayscale, truecolor, palette, grayscale+alpha, truecolor+alpha) at every valid bit depth (1/2/4/8/16 — including via new Gray16/Rgb48/Rgba64 pixel formats), Adam7 interlacing, palette + tRNS transparency (both per-entry and single-color-key), optional opt-in gamma correction (PngDecoderOptions.ScreenGamma, mirroring libpng's png_set_gamma), and the common ancillary chunks (gAMA/cHRM/sRGB/iCCP/pHYs/tEXt/zTXt/iTXt/tIME/bKGD). Encoding doesn't yet build an indexed palette from an arbitrary truecolor source (no automatic quantization) — non-palette sources always encode as grayscale/truecolor(+alpha).
  • Other formats (WebP, GIF, ...) are not yet implemented. The public API (Image, IImageDecoder/IImageEncoder, ImageFormatManager) is designed to support them without breaking changes when they're added.

Usage

using PeachImage;
using PeachImage.Formats.Jpeg;

// Codecs are registered automatically — no setup call needed.
using var image = Image.Load("photo.jpg");

using var output = File.Create("resaved.jpg");
image.Save(output, "jpeg", new JpegEncoderOptions { Quality = 85 });

Building & testing

dotnet build PeachImage.slnx
dotnet test PeachImage.slnx

The first dotnet test run automatically fetches JPEG, BMP, and PNG test corpora (the Imazen codec-corpus conformance sets, image-rs/jpeg-decoder's test assets, and — for BMP — the bmp-conformance subset of codec-corpus, itself generated from Jason Summers' bmpsuite; for PNG — the pngsuite subset of codec-corpus, a mirror of Willem van Schaik's classic PngSuite conformance set) into the gitignored tests/corpus/ directory — no separate script needed. Set PEACHIMAGE_SKIP_CORPUS_FETCH=1 to skip network access; corpus-driven tests report as skipped rather than failing.

Benchmarking

dotnet run -c Release --project bench/PeachImage.Benchmarks

Compares PeachImage's JPEG/BMP/PNG decode and encode throughput against SkiaSharp (a dev-only dependency of the benchmark project only — never referenced by the shipped library), a single consistent baseline across all three formats. BMP encode has no real-world baseline here — SkiaSharp's encoder doesn't support BMP output — so BmpEncodeBenchmarks tracks PeachImage's own throughput only. See LIBRARY_COMPARISON.md for a summary of the latest results.

License

MIT — see LICENSE. One algorithm's numerical structure (the AAN fast DCT/IDCT butterfly wiring) was referenced from libjpeg-turbo during implementation; see THIRD-PARTY-LICENSES.md.

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 (1)

Showing the top 1 NuGet packages that depend on PeachImage:

Package Downloads
PeachPDF

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.4.6 3,406 9/16/2026
0.4.5 209 9/15/2026
0.4.4 127 9/15/2026
0.4.3 117 9/15/2026
0.4.2 3,985 8/26/2026
0.4.1 837 8/23/2026
0.3.1 122 8/21/2026
0.3.0 109 8/20/2026
0.2.2 284 8/17/2026
0.2.1 119 8/17/2026
0.2.0 129 8/17/2026
0.1.2 130 8/15/2026
0.1.0 125 8/15/2026