"System.NotSupportedException: ccitt extensions are not supported" when loading some tifs #2451
Closed
Description
Prerequisites
- I have written a descriptive issue title
- I have verified that I am running the latest version of ImageSharp
- I have verified if the problem exist in both
DEBUG
andRELEASE
mode - I have searched open and closed issues to ensure it has not already been reported
ImageSharp version
3.0.2-alpha.0.14
Other ImageSharp packages and versions
No
Environment (Operating system, version and so on)
Linux
.NET Framework version
NET 6
Description
When loading some Tiffs, we received this exception while decoding.
Other windows applications can open the file.
BTW: I have bought a Commercial License (couldnt find the checkbox to inform).
System.NotSupportedException: ccitt extensions are not supported.
at SixLabors.ImageSharp.Formats.Tiff.Compression.Decompressors.T6TiffCompression.Decode2DScanline(T6BitReader bitReader, Boolean whiteIsZero, CcittReferenceScanline referenceScanline, Span`1 scanline)
at SixLabors.ImageSharp.Formats.Tiff.Compression.Decompressors.T6TiffCompression.Decompress(BufferedReadStream stream, Int32 byteCount, Int32 stripHeight, Span`1 buffer, CancellationToken cancellationToken)
at SixLabors.ImageSharp.Formats.Tiff.TiffDecoderCore.DecodeStripsChunky[TPixel](ImageFrame`1 frame, Int32 rowsPerStrip, Span`1 stripOffsets, Span`1 stripByteCounts, CancellationToken cancellationToken)
at SixLabors.ImageSharp.Formats.Tiff.TiffDecoderCore.DecodeImageWithStrips[TPixel](ExifProfile tags, ImageFrame`1 frame, CancellationToken cancellationToken)
at SixLabors.ImageSharp.Formats.Tiff.TiffDecoderCore.DecodeFrame[TPixel](ExifProfile tags, CancellationToken cancellationToken)
at SixLabors.ImageSharp.Formats.Tiff.TiffDecoderCore.Decode[TPixel](BufferedReadStream stream, CancellationToken cancellationToken)
at SixLabors.ImageSharp.Formats.ImageDecoderUtilities.Decode[TPixel](IImageDecoderInternals decoder, Configuration configuration, Stream stream, Func`3 largeImageExceptionFactory, CancellationToken cancellationToken)
at SixLabors.ImageSharp.Formats.Tiff.TiffDecoder.Decode[TPixel](DecoderOptions options, Stream stream, CancellationToken cancellationToken)
at SixLabors.ImageSharp.Formats.Tiff.TiffDecoder.Decode(DecoderOptions options, Stream stream, CancellationToken cancellationToken)
at SixLabors.ImageSharp.Formats.ImageDecoder.<>c__DisplayClass1_0.<Decode>b__0(Stream s)
at SixLabors.ImageSharp.Formats.ImageDecoder.WithSeekableStream[T](DecoderOptions options, Stream stream, Func`2 action)
at SixLabors.ImageSharp.Formats.ImageDecoder.Decode(DecoderOptions options, Stream stream)
Steps to Reproduce
Load the provided images from a stream.
The error throws when decoding.
public static MemoryStream ConverterPara(MemoryStream imagemStream)
{
var pngEncoder = new PngEncoder()
{
FilterMethod = PngFilterMethod.Adaptive,
CompressionLevel = PngCompressionLevel.BestCompression,
TransparentColorMode = PngTransparentColorMode.Clear,
ColorType = PngColorType.Grayscale,
BitDepth = PngBitDepth.Bit4,
SkipMetadata = true
};
imagemStream.Position = 0;
var resultadoStream = new MemoryStream();
using (var imagem = Image.Load(imagemStream))
{
using (var clone = imagem.CloneAs<L8>())
clone.Save(resultadoStream, pngEncoder);
}
return resultadoStream;
}