CoreJ2K 1.3.1.77
Prefix Reserveddotnet add package CoreJ2K --version 1.3.1.77
NuGet\Install-Package CoreJ2K -Version 1.3.1.77
<PackageReference Include="CoreJ2K" Version="1.3.1.77" />
<PackageVersion Include="CoreJ2K" Version="1.3.1.77" />
<PackageReference Include="CoreJ2K" />
paket add CoreJ2K --version 1.3.1.77
#r "nuget: CoreJ2K, 1.3.1.77"
#:package CoreJ2K@1.3.1.77
#addin nuget:?package=CoreJ2K&version=1.3.1.77
#tool nuget:?package=CoreJ2K&version=1.3.1.77
CoreJ2K - A Managed and Portable JPEG2000 Codec
Copyright (c) 1999-2000 JJ2000 Partners;
Copyright (c) 2007-2012 Jason S. Clary;
Copyright (c) 2013-2016 Anders Gustafsson, Cureos AB;
Copyright (c) 2024-2025 Sjofn LLC.
Licensed and distributable under the terms of the BSD license
Summary
CoreJ2K is a managed, portable implementation of a JPEG 2000 codec for .NET platforms. It is a modern fork of CSJ2K (itself a C# port of jj2000) adapted for .NET Standard and newer .NET targets.
This project provides decoding and encoding of JPEG 2000 images and small helpers to bridge platform image types to the codec. The CoreJ2K.Skia package supplies SkiaSharp integrations (e.g. SKBitmap, SKPixmap).
Installation
Install the core library and the Skia integration from NuGet:
dotnet add package CoreJ2K
dotnet add package CoreJ2K.Skia
dotnet add package SkiaSharp
(Use the package manager appropriate for your project type.)
Quick examples (using CoreJ2K.Skia)
These examples assume you reference CoreJ2K, CoreJ2K.Skia and SkiaSharp.
Decoding a JPEG 2000 file to an SKBitmap and saving as PNG:
using System.IO;
using SkiaSharp;
using CoreJ2K; // J2kImage
// Decode from file stream
using var fs = File.OpenRead("image.j2k");
var portable = J2kImage.FromStream(fs);
var bitmap = portable.As<SKBitmap>();
// Save as PNG
using var outFs = File.OpenWrite("out.png");
bitmap.Encode(outFs, SKEncodedImageFormat.Png, 90);
Decoding from a byte array:
byte[] j2kData = File.ReadAllBytes("image.j2k");
var portable = J2kImage.FromBytes(j2kData);
var bitmap = portable.As<SKBitmap>();
// Use `bitmap` in your app (draw, convert, save...)
Encoding an SKBitmap to JPEG2000 bytes (default options):
using SkiaSharp;
using CoreJ2K;
// `bitmap` is an existing SKBitmap
byte[] j2kBytes = J2kImage.ToBytes(bitmap);
File.WriteAllBytes("encoded.j2k", j2kBytes);
Encoding from low-level image source (PGM/PPM/PGX) or platform images
// Use J2kImage.CreateEncodableSource(Stream) when you have PGM/PPM/PGX data as streams
// or pass a platform-specific image (e.g. SKBitmap) to J2kImage.ToBytes(object)
Advanced encoding parameters (ParameterList)
J2kImage.ToBytes accepts an optional ParameterList to control encoding options (compression rate, wavelet levels, tiling, component transform, etc.). The library expects parameter names without leading dashes (the same names used internally). Common encoder keys (exact names accepted) include:
rate� target output bitrate in bits-per-pixel (bpp) (string/float)lossless�on/offfile_format�on/off(wrap codestream in JP2)tiles� nominal tile width and height, e.g."1024 1024"tile_parts� packets per tile-part (integer)Wlev� number of wavelet decomposition levels (integer)Wcboff� code-block partition origin: two ints"0 0"or"1 1"Ffilters� wavelet filters (e.g."w5x3"or"w9x7")Mct� component transform (on/offorrct/ictper tile)Qtype,Qstep,Qguard_bits� quantization controlsAlayers� explicit layers specification (rate and optional +layers)Aptype� progression order specification (e.g."res"or"layer")pph_tile,pph_main,Psop,Peph� packet/header options
Below are practical examples that use the exact parameter names the encoder recognizes.
Lossy encoding with a target rate and common options:
using CoreJ2K;
using SkiaSharp;
var parameters = new ParameterList();
parameters["rate"] = "0.5"; // target 0.5 bpp
parameters["file_format"] = "on"; // produce a .jp2 wrapper
parameters["tiles"] = "1024 1024"; // tile size
parameters["Wlev"] = "5"; // 5 decomposition levels
parameters["Wcboff"] = "0 0"; // code-block origin
byte[] j2kBytes = J2kImage.ToBytes(bitmap, parameters);
File.WriteAllBytes("encoded_lossy.j2k", j2kBytes);
Lossless encoding (uses reversible quantization / w5x3 by default):
var parameters = new ParameterList();
parameters["lossless"] = "on";
parameters["file_format"] = "on";
byte[] j2kBytes = J2kImage.ToBytes(bitmap, parameters);
Advanced layer and progression control (explicit layers + progression type):
// 'Alayers' uses the same syntax as the encoder internals, e.g. "0.015 +20 2.0 +10"
var pl = new ParameterList();
pl["rate"] = "0.2";
pl["Alayers"] = "0.015 +20 2.0 +10"; // example: multiple target rates with extra layers
pl["Aptype"] = "res"; // progression mode: "res", "layer", "pos-comp", "comp-pos", or "res-pos"
byte[] j2kBytes = J2kImage.ToBytes(bitmap, pl);
Set wavelet filters and quantization explicitly:
var p = new ParameterList();
p["Ffilters"] = "w9x7"; // use 9x7 (irreversible) filters
p["Qtype"] = "expounded"; // non-reversible quantization type
p["Wcboff"] = "0 0";
byte[] bytes = J2kImage.ToBytes(bitmap, p);
Note: parameter names and value formats are codec-specific and must match the strings above. Use the ParameterList indexer (or Add) to set keys. Some options accept per-tile or per-component specifications using the library's option syntax (see Alayers, Ffilters, Qtype, Mct handling in the source).
Platform-specific package targets and runtime notes
This repository contains multiple packages and TFMs to support a wide range of .NET runtimes. Pick the package and target framework appropriate for your application:
Core libraries:
CoreJ2Ktargetsnetstandard2.0andnetstandard2.1for broad compatibility.CoreJ2K.Skiatargetsnetstandard2.0/netstandard2.1and also hasnet8.0/net9.0builds in the workspace for modern runtimes.CoreJ2K.Pfimtargetsnetstandard2.0/netstandard2.1and also hasnet8.0/net9.0builds in the workspace for modern runtimes.CoreJ2K.ImageSharptargetsnet8.0andnet9.0for optimized modern integrations.CoreJ2K.Windowsproduces multi-TFM packages:netstandard2.0,netstandard2.1,net8.0-windows,net9.0-windows.
.NET Framework 4.8.1 compatibility: projects that target
netstandard2.0can be consumed from .NET Framework 4.8.1 applications. Prefer thenetstandard2.0package when targeting legacy frameworks.SkiaSharp native assets: when using
CoreJ2K.Skiainclude the appropriateSkiaSharp.NativeAssets.*package for your OS and app type (for exampleSkiaSharp.NativeAssets.Linux,SkiaSharp.NativeAssets.Windows,SkiaSharp.NativeAssets.Desktop, or platform-specific runtime packs). Without native assetsSKBitmapwill not function at runtime.Check NuGet package pages for runtime support tables and any native dependency guidance (native runtimes, RIDs, and platform-specific notes).
Usage notes
PortableImageis the library's cross-platform image wrapper. UseAs<T>()to cast to platform-specific types, for exampleAs<SKBitmap>()when using the Skia integration.J2kImage.ToBytes(object, ParameterList?)accepts platform-specific image objects or codec-specific sources. If encoding parameters are required you can supply aParameterListinstance with keys shown above.- The library exposes many encoder options using the same names as the original JJ2000/CSJ2K code; check the source for the full list of supported keys (e.g.
encoder_pinfoinJ2kImage).
Links
Badges and packages
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- System.Memory (>= 4.6.3)
-
.NETStandard 2.1
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (5)
Showing the top 5 NuGet packages that depend on CoreJ2K:
| Package | Downloads |
|---|---|
|
CoreJ2K.Skia
.NETStandard JPEG-2000 codec library with SkiaSharp support |
|
|
CoreJ2K.Windows
.NETStandard JPEG-2000 codec library with System.Drawing support |
|
|
CoreJ2K.ImageSharp
Cross-platform JPEG2000 codec library with ImageSharp integration for .NET Standard |
|
|
CoreJ2K.Pfim
.NETStandard JPEG-2000 codec library with Pfim support |
|
|
CoreJ2K.ImageSharp-Official
Official CoreJ2K .NETStandard JPEG-2000 codec library with ImageSharp support |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.3.1.77 | 18 | 11/13/2025 |
| 1.3.0.75 | 221 | 11/11/2025 |
| 1.2.2.68 | 704 | 11/6/2025 |
| 1.2.1.63 | 483 | 10/31/2025 |
| 1.2.0.55 | 1,571 | 10/12/2025 |
| 1.1.2.50 | 3,886 | 6/14/2025 |
| 1.1.1.48 | 2,267 | 4/30/2025 |
| 1.0.7.39 | 422 | 4/26/2025 |
| 1.0.6.37 | 1,431 | 1/22/2025 |
| 1.0.5.32 | 1,933 | 1/2/2025 |
| 1.0.5.31 | 190 | 1/2/2025 |
| 1.0.5.29 | 181 | 1/2/2025 |
| 1.0.5.27 | 818 | 1/2/2025 |
| 1.0.5.26 | 204 | 1/2/2025 |
| 1.0.4.21 | 1,869 | 11/1/2024 |
| 1.0.3.18 | 217 | 11/1/2024 |
| 1.0.2.13 | 974 | 8/22/2024 |
| 1.0.1.10 | 259 | 8/22/2024 |
| 1.0.0.5 | 299 | 8/21/2024 |