CoreJ2K 1.3.1.77

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

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)
  • losslesson/off
  • file_formaton/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/off or rct/ict per tile)
  • Qtype, Qstep, Qguard_bits � quantization controls
  • Alayers � 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:

    • CoreJ2K targets netstandard2.0 and netstandard2.1 for broad compatibility.
    • CoreJ2K.Skia targets netstandard2.0 / netstandard2.1 and also has net8.0 / net9.0 builds in the workspace for modern runtimes.
    • CoreJ2K.Pfim targets netstandard2.0 / netstandard2.1 and also has net8.0 / net9.0 builds in the workspace for modern runtimes.
    • CoreJ2K.ImageSharp targets net8.0 and net9.0 for optimized modern integrations.
    • CoreJ2K.Windows produces multi-TFM packages: netstandard2.0, netstandard2.1, net8.0-windows, net9.0-windows.
  • .NET Framework 4.8.1 compatibility: projects that target netstandard2.0 can be consumed from .NET Framework 4.8.1 applications. Prefer the netstandard2.0 package when targeting legacy frameworks.

  • SkiaSharp native assets: when using CoreJ2K.Skia include the appropriate SkiaSharp.NativeAssets.* package for your OS and app type (for example SkiaSharp.NativeAssets.Linux, SkiaSharp.NativeAssets.Windows, SkiaSharp.NativeAssets.Desktop, or platform-specific runtime packs). Without native assets SKBitmap will 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

  • PortableImage is the library's cross-platform image wrapper. Use As<T>() to cast to platform-specific types, for example As<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 a ParameterList instance 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_pinfo in J2kImage).

Badges and packages

CoreJ2K NuGet-Release CoreJ2K.Skia NuGet-Release CoreJ2K.Windows NuGet-Release
NuGet Downloads
Commits per month
Build status
Codacy Badge
ZEC BTC

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

  • .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