SixLabors/ImageSharp · error · NotSupportedException

Not supported decoder compression method

Error message

Not supported decoder compression method: {compressionType}

What it means

Thrown when decoding an EXR file whose compression method is not supported by the decoder. EXR supports several compression types (None, RLE, ZIP, PIZ, etc.); files written with a method this decoder does not implement cannot be decompressed. This is a NotSupportedException signaling an unimplemented code path, not data corruption.

Solutions

  1. Re-export the EXR with a supported compression method (None, RLE, ZIP, PIZ) using OpenEXR tooling or the originating application
  2. Check the ImageSharp version and upgrade, since newer versions support more compression methods
  3. Pre-convert the file with `exrmakepreview`/`exrheader` inspection + oiiotool conversion to an uncompressed EXR
  4. If the byte is invalid, validate the source file is not truncated/corrupt

Example fix

// before
var image = Image.Load(path); // throws for unsupported compression
// after
try { var image = Image.Load(path); }
catch (NotSupportedException) { Process.Start("oiiotool", $"{path} -d \".*\" -o converted.exr"); var image = Image.Load("converted.exr"); }
Defensive patterns

Strategy: try-catch

Validate before calling

// Inspect EXR compression byte (offset 4 of the 8-byte version header)
using var fs = File.OpenRead(path);
var header = new byte[8];
if (fs.Read(header, 0, 8) < 8) throw new InvalidDataException("Not EXR");
int compression = header[5] & 0x0F;
bool supported = compression is 0 or 1 or 2 or 3 or 4; // None/RLE/Zips/Zip/Piz

Try / catch

try { return Image.Load(stream); }
catch (NotSupportedException ex) when (ex.Message.StartsWith("Not supported decoder compression")) { return ConvertWithExternalTool(stream); }

Prevention

When it happens

Trigger: Image.Load / DecodeAsync on an EXR file whose version/header declares an unsupported compressionType (e.g. B44/B44A/DWA on decoders lacking them, or a corrupted/invalid compression byte).

Common situations: Receiving EXR files from renderers or tools (e.g. DWAA/DWB from newer OpenEXR versions) that use compression methods newer than the ImageSharp EXR decoder supports; mixing EXR writer/decoder versions.

Related errors


AI-assisted analysis of SixLabors/ImageSharp@59ce6af6fc (2026-09-13). Data as JSON: /api/errors/1e731911bba27f94. Report an issue: GitHub.

Appendix: source

Thrown at src/ImageSharp/Formats/Exr/ExrThrowHelper.cs:14

// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.

using System.Diagnostics.CodeAnalysis;

namespace SixLabors.ImageSharp.Formats.Exr;

/// <summary>
/// Cold path optimizations for throwing exr format based exceptions.
/// </summary>
internal static class ExrThrowHelper
{
    [DoesNotReturn]
    public static Exception NotSupportedDecompressor(string compressionType) => throw new NotSupportedException($"Not supported decoder compression method: {compressionType}");

    [DoesNotReturn]
    public static void ThrowInvalidImageContentException(string errorMessage) => throw new InvalidImageContentException(errorMessage);

    [DoesNotReturn]
    public static void ThrowNotSupportedVersion() => throw new NotSupportedException("Unsupported EXR version");

    [DoesNotReturn]
    public static void ThrowNotSupported(string msg) => throw new NotSupportedException(msg);

    [DoesNotReturn]
    public static void ThrowInvalidImageHeader() => throw new InvalidImageContentException("Invalid EXR image header");

    [DoesNotReturn]
    public static void ThrowInvalidImageHeader(string msg) => throw new InvalidImageContentException(msg);

    [DoesNotReturn]
    public static Exception NotSupportedCompressor(string compressionType) => throw new NotSupportedException($"Not supported encoder compression method: {compressionType}");

View on GitHub (pinned to 59ce6af6fc)