Browse Source
Merge pull request #2150 from SixLabors/bp/Issue2149
Fix regression in TIF image loading
pull/2175/head
James Jackson-South
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
11 additions and
0 deletions
-
src/ImageSharp/Formats/Tiff/Compression/Decompressors/T6TiffCompression.cs
-
tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs
-
tests/ImageSharp.Tests/TestImages.cs
-
tests/Images/Input/Tiff/Issues/Group4CompressionWithStrips.tiff
|
|
|
@ -52,6 +52,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff.Compression.Decompressors |
|
|
|
protected override void Decompress(BufferedReadStream stream, int byteCount, int stripHeight, Span<byte> buffer) |
|
|
|
{ |
|
|
|
int height = stripHeight; |
|
|
|
buffer.Clear(); |
|
|
|
|
|
|
|
using System.Buffers.IMemoryOwner<byte> scanLineBuffer = this.Allocator.Allocate<byte>(this.width * 2); |
|
|
|
Span<byte> scanLine = scanLineBuffer.GetSpan().Slice(0, this.width); |
|
|
|
|
|
|
|
@ -665,6 +665,12 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
// https://github.com/SixLabors/ImageSharp/issues/2149
|
|
|
|
[Theory] |
|
|
|
[WithFile(Issues2149, PixelTypes.Rgba32)] |
|
|
|
public void TiffDecoder_CanDecode_Fax4CompressedWithStrips<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> => TestTiffDecoder(provider); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFileCollection(nameof(MultiframeTestImages), PixelTypes.Rgba32)] |
|
|
|
public void DecodeMultiframe<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
|
|
|
|
@ -917,6 +917,7 @@ namespace SixLabors.ImageSharp.Tests |
|
|
|
public const string Issues1716Rgb161616BitLittleEndian = "Tiff/Issues/Issue1716.tiff"; |
|
|
|
public const string Issues1891 = "Tiff/Issues/Issue1891.tiff"; |
|
|
|
public const string Issues2123 = "Tiff/Issues/Issue2123.tiff"; |
|
|
|
public const string Issues2149 = "Tiff/Issues/Group4CompressionWithStrips.tiff"; |
|
|
|
|
|
|
|
public const string SmallRgbDeflate = "Tiff/rgb_small_deflate.tiff"; |
|
|
|
public const string SmallRgbLzw = "Tiff/rgb_small_lzw.tiff"; |
|
|
|
|
|
|
|
@ -0,0 +1,3 @@ |
|
|
|
version https://git-lfs.github.com/spec/v1 |
|
|
|
oid sha256:141320615d58b2971aedfeba8d408c38c0b4ab43024678254cecaebf0ed7edb0 |
|
|
|
size 4440 |