diff --git a/src/ImageSharp/Formats/Tiff/ImageExtensions.cs b/src/ImageSharp/Formats/Tiff/ImageExtensions.cs index 01384b8271..db160bd9f8 100644 --- a/src/ImageSharp/Formats/Tiff/ImageExtensions.cs +++ b/src/ImageSharp/Formats/Tiff/ImageExtensions.cs @@ -6,26 +6,26 @@ namespace ImageSharp { using System.IO; - using Formats; + using ImageSharp.PixelFormats; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Saves the image to the given stream with the tiff format. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The stream to save the image to. /// Thrown if the stream is null. /// - /// The . + /// The . /// - public static Image SaveAsTiff(this Image source, Stream stream) - where TColor : struct, IPixel + public static Image SaveAsTiff(this Image source, Stream stream) + where TPixel : struct, IPixel { return SaveAsTiff(source, stream, null); } @@ -33,16 +33,16 @@ namespace ImageSharp /// /// Saves the image to the given stream with the tiff format. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The stream to save the image to. /// The options for the encoder. /// Thrown if the stream is null. /// - /// The . + /// The . /// - public static Image SaveAsTiff(this Image source, Stream stream, ITiffEncoderOptions options) - where TColor : struct, IPixel + public static Image SaveAsTiff(this Image source, Stream stream, ITiffEncoderOptions options) + where TPixel : struct, IPixel { TiffEncoder encoder = new TiffEncoder(); encoder.Encode(source, stream, options); diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero1TiffColor.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero1TiffColor.cs index 5e486c7fef..34bc5e7314 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero1TiffColor.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero1TiffColor.cs @@ -8,6 +8,7 @@ namespace ImageSharp.Formats.Tiff using System; using System.Runtime.CompilerServices; using ImageSharp; + using ImageSharp.PixelFormats; /// /// Implements the 'WhiteIsZero' photometric interpretation (optimised for bilevel images). @@ -17,7 +18,7 @@ namespace ImageSharp.Formats.Tiff /// /// Decodes pixel data using the current photometric interpretation. /// - /// The pixel format. + /// The pixel format. /// The buffer to read image data from. /// The image buffer to write pixels to. /// The x-coordinate of the left-hand side of the image block. @@ -25,10 +26,10 @@ namespace ImageSharp.Formats.Tiff /// The width of the image block. /// The height of the image block. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Decode(byte[] data, PixelAccessor pixels, int left, int top, int width, int height) - where TColor : struct, IPixel + public static void Decode(byte[] data, PixelAccessor pixels, int left, int top, int width, int height) + where TPixel : struct, IPixel { - TColor color = default(TColor); + TPixel color = default(TPixel); uint offset = 0; diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero4TiffColor.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero4TiffColor.cs index 98f74dca0e..00653feb44 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero4TiffColor.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero4TiffColor.cs @@ -7,6 +7,7 @@ namespace ImageSharp.Formats.Tiff { using System.Runtime.CompilerServices; using ImageSharp; + using ImageSharp.PixelFormats; /// /// Implements the 'WhiteIsZero' photometric interpretation (optimised for 4-bit grayscale images). @@ -16,7 +17,7 @@ namespace ImageSharp.Formats.Tiff /// /// Decodes pixel data using the current photometric interpretation. /// - /// The pixel format. + /// The pixel format. /// The buffer to read image data from. /// The image buffer to write pixels to. /// The x-coordinate of the left-hand side of the image block. @@ -24,10 +25,10 @@ namespace ImageSharp.Formats.Tiff /// The width of the image block. /// The height of the image block. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Decode(byte[] data, PixelAccessor pixels, int left, int top, int width, int height) - where TColor : struct, IPixel + public static void Decode(byte[] data, PixelAccessor pixels, int left, int top, int width, int height) + where TPixel : struct, IPixel { - TColor color = default(TColor); + TPixel color = default(TPixel); uint offset = 0; bool isOddWidth = (width & 1) == 1; diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero8TiffColor.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero8TiffColor.cs index 8ddafd9833..8168839ad7 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero8TiffColor.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero8TiffColor.cs @@ -7,6 +7,7 @@ namespace ImageSharp.Formats.Tiff { using System.Runtime.CompilerServices; using ImageSharp; + using ImageSharp.PixelFormats; /// /// Implements the 'WhiteIsZero' photometric interpretation (optimised for 8-bit grayscale images). @@ -16,7 +17,7 @@ namespace ImageSharp.Formats.Tiff /// /// Decodes pixel data using the current photometric interpretation. /// - /// The pixel format. + /// The pixel format. /// The buffer to read image data from. /// The image buffer to write pixels to. /// The x-coordinate of the left-hand side of the image block. @@ -24,10 +25,10 @@ namespace ImageSharp.Formats.Tiff /// The width of the image block. /// The height of the image block. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void Decode(byte[] data, PixelAccessor pixels, int left, int top, int width, int height) - where TColor : struct, IPixel + public static void Decode(byte[] data, PixelAccessor pixels, int left, int top, int width, int height) + where TPixel : struct, IPixel { - TColor color = default(TColor); + TPixel color = default(TPixel); uint offset = 0; diff --git a/src/ImageSharp/Formats/Tiff/TiffDecoder.cs b/src/ImageSharp/Formats/Tiff/TiffDecoder.cs index 333c707e31..6a605c8782 100644 --- a/src/ImageSharp/Formats/Tiff/TiffDecoder.cs +++ b/src/ImageSharp/Formats/Tiff/TiffDecoder.cs @@ -6,6 +6,7 @@ namespace ImageSharp.Formats { using System.IO; + using ImageSharp.PixelFormats; /// /// Image decoder for generating an image out of a TIFF stream. @@ -13,14 +14,14 @@ namespace ImageSharp.Formats public class TiffDecoder : IImageDecoder { /// - public Image Decode(Configuration configuration, Stream stream, IDecoderOptions options) - where TColor : struct, IPixel + public Image Decode(Configuration configuration, Stream stream, IDecoderOptions options) + where TPixel : struct, IPixel { Guard.NotNull(stream, "stream"); using (TiffDecoderCore decoder = new TiffDecoderCore(options, configuration)) { - return decoder.Decode(stream); + return decoder.Decode(stream); } } } diff --git a/src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs b/src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs index ab84dd31e9..225bddb1ed 100644 --- a/src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs +++ b/src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs @@ -10,6 +10,7 @@ namespace ImageSharp.Formats using System.IO; using System.Text; using ImageSharp.Formats.Tiff; + using ImageSharp.PixelFormats; /// /// Performs the tiff decoding operation. @@ -82,17 +83,17 @@ namespace ImageSharp.Formats /// Decodes the image from the specified and sets /// the data to image. /// - /// The pixel format. + /// The pixel format. /// The stream, where the image should be. /// The decoded image. - public Image Decode(Stream stream) - where TColor : struct, IPixel + public Image Decode(Stream stream) + where TPixel : struct, IPixel { this.InputStream = stream; uint firstIfdOffset = this.ReadHeader(); TiffIfd firstIfd = this.ReadIfd(firstIfdOffset); - Image image = this.DecodeImage(firstIfd); + Image image = this.DecodeImage(firstIfd); return image; } @@ -175,11 +176,11 @@ namespace ImageSharp.Formats /// /// Decodes the image data from a specified IFD. /// - /// The pixel format. + /// The pixel format. /// The IFD to read the image from. /// The decoded image. - public Image DecodeImage(TiffIfd ifd) - where TColor : struct, IPixel + public Image DecodeImage(TiffIfd ifd) + where TPixel : struct, IPixel { if (!ifd.TryGetIfdEntry(TiffTags.ImageLength, out TiffIfdEntry imageLengthEntry) || !ifd.TryGetIfdEntry(TiffTags.ImageWidth, out TiffIfdEntry imageWidthEntry)) @@ -190,7 +191,7 @@ namespace ImageSharp.Formats int width = (int)this.ReadUnsignedInteger(ref imageWidthEntry); int height = (int)this.ReadUnsignedInteger(ref imageLengthEntry); - Image image = Image.Create(width, height, this.configuration); + Image image = new Image(this.configuration, width, height); TiffResolutionUnit resolutionUnit = TiffResolutionUnit.Inch; if (ifd.TryGetIfdEntry(TiffTags.ResolutionUnit, out TiffIfdEntry resolutionUnitEntry)) @@ -224,46 +225,12 @@ namespace ImageSharp.Formats int rowsPerStrip = (int)this.ReadUnsignedInteger(ref rowsPerStripEntry); uint[] stripOffsets = this.ReadUnsignedIntegerArray(ref stripOffsetsEntry); uint[] stripByteCounts = this.ReadUnsignedIntegerArray(ref stripByteCountsEntry); - DecodeImageStrips(image, rowsPerStrip, stripOffsets, stripByteCounts); + this.DecodeImageStrips(image, rowsPerStrip, stripOffsets, stripByteCounts); } return image; } - /// - /// Decodes the image data for strip encoded data. - /// - /// The pixel format. - /// The image to decode data into. - /// The number of rows per strip of data. - /// An array of byte offsets to each strip in the image. - /// An array of the size of each strip (in bytes). - private void DecodeImageStrips(Image image, int rowsPerStrip, uint[] stripOffsets, uint[] stripByteCounts) - where TColor : struct, IPixel - { - int uncompressedStripSize = this.CalculateImageBufferSize(image.Width, rowsPerStrip); - - using (PixelAccessor pixels = image.Lock()) - { - byte[] stripBytes = ArrayPool.Shared.Rent(uncompressedStripSize); - - try - { - for (int i = 0; i < stripOffsets.Length; i++) - { - int stripHeight = i < stripOffsets.Length - 1 || image.Height % rowsPerStrip == 0 ? rowsPerStrip : image.Height % rowsPerStrip; - - this.DecompressImageBlock(stripOffsets[i], stripByteCounts[i], stripBytes); - this.ProcessImageBlock(stripBytes, pixels, 0, rowsPerStrip * i, image.Width, stripHeight); - } - } - finally - { - ArrayPool.Shared.Return(stripBytes); - } - } - } - /// /// Determines the TIFF compression and color types, and reads any associated parameters. /// @@ -412,15 +379,15 @@ namespace ImageSharp.Formats /// /// Decodes pixel data using the current photometric interpretation. /// - /// The pixel format. + /// The pixel format. /// The buffer to read image data from. /// The image buffer to write pixels to. /// The x-coordinate of the left-hand side of the image block. /// The y-coordinate of the top of the image block. /// The width of the image block. /// The height of the image block. - public void ProcessImageBlock(byte[] data, PixelAccessor pixels, int left, int top, int width, int height) - where TColor : struct, IPixel + public void ProcessImageBlock(byte[] data, PixelAccessor pixels, int left, int top, int width, int height) + where TPixel : struct, IPixel { switch (this.ColorType) { @@ -984,5 +951,39 @@ namespace ImageSharp.Formats return BitConverter.ToDouble(buffer, 0); } + + /// + /// Decodes the image data for strip encoded data. + /// + /// The pixel format. + /// The image to decode data into. + /// The number of rows per strip of data. + /// An array of byte offsets to each strip in the image. + /// An array of the size of each strip (in bytes). + private void DecodeImageStrips(Image image, int rowsPerStrip, uint[] stripOffsets, uint[] stripByteCounts) + where TPixel : struct, IPixel + { + int uncompressedStripSize = this.CalculateImageBufferSize(image.Width, rowsPerStrip); + + using (PixelAccessor pixels = image.Lock()) + { + byte[] stripBytes = ArrayPool.Shared.Rent(uncompressedStripSize); + + try + { + for (int i = 0; i < stripOffsets.Length; i++) + { + int stripHeight = i < stripOffsets.Length - 1 || image.Height % rowsPerStrip == 0 ? rowsPerStrip : image.Height % rowsPerStrip; + + this.DecompressImageBlock(stripOffsets[i], stripByteCounts[i], stripBytes); + this.ProcessImageBlock(stripBytes, pixels, 0, rowsPerStrip * i, image.Width, stripHeight); + } + } + finally + { + ArrayPool.Shared.Return(stripBytes); + } + } + } } } diff --git a/src/ImageSharp/Formats/Tiff/TiffEncoder.cs b/src/ImageSharp/Formats/Tiff/TiffEncoder.cs index c54a43ede4..7bcb575db5 100644 --- a/src/ImageSharp/Formats/Tiff/TiffEncoder.cs +++ b/src/ImageSharp/Formats/Tiff/TiffEncoder.cs @@ -7,6 +7,7 @@ namespace ImageSharp.Formats { using System; using System.IO; + using ImageSharp.PixelFormats; /// /// Encoder for writing the data image to a stream in TIFF format. @@ -14,8 +15,8 @@ namespace ImageSharp.Formats public class TiffEncoder : IImageEncoder { /// - public void Encode(Image image, Stream stream, IEncoderOptions options) - where TColor : struct, IPixel + public void Encode(Image image, Stream stream, IEncoderOptions options) + where TPixel : struct, IPixel { ITiffEncoderOptions tiffOptions = TiffEncoderOptions.Create(options); @@ -23,14 +24,14 @@ namespace ImageSharp.Formats } /// - /// Encodes the image to the specified stream from the . + /// Encodes the image to the specified stream from the . /// - /// The pixel format. - /// The to encode from. + /// The pixel format. + /// The to encode from. /// The to encode the image data to. /// The options for the encoder. - public void Encode(Image image, Stream stream, ITiffEncoderOptions options) - where TColor : struct, IPixel + public void Encode(Image image, Stream stream, ITiffEncoderOptions options) + where TPixel : struct, IPixel { throw new NotImplementedException(); } diff --git a/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/PhotometricInterpretation/PhotometricInterpretationTestBase.cs b/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/PhotometricInterpretation/PhotometricInterpretationTestBase.cs index 3c245855d3..ab9a891161 100644 --- a/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/PhotometricInterpretation/PhotometricInterpretationTestBase.cs +++ b/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/PhotometricInterpretation/PhotometricInterpretationTestBase.cs @@ -10,16 +10,16 @@ namespace ImageSharp.Tests public abstract class PhotometricInterpretationTestBase { - public static Color[][] Offset(Color[][] input, int xOffset, int yOffset, int width, int height) + public static Rgba32[][] Offset(Rgba32[][] input, int xOffset, int yOffset, int width, int height) { int inputHeight = input.Length; int inputWidth = input[0].Length; - Color[][] output = new Color[height][]; + Rgba32[][] output = new Rgba32[height][]; for (int y = 0; y < output.Length; y++) { - output[y] = new Color[width]; + output[y] = new Rgba32[width]; } for (int y = 0; y < inputHeight; y++) @@ -33,18 +33,18 @@ namespace ImageSharp.Tests return output; } - public static void AssertDecode(Color[][] expectedResult, Action> decodeAction) + public static void AssertDecode(Rgba32[][] expectedResult, Action> decodeAction) { int resultWidth = expectedResult[0].Length; int resultHeight = expectedResult.Length; - Image image = new Image(resultWidth, resultHeight); + Image image = new Image(resultWidth, resultHeight); - using (PixelAccessor pixels = image.Lock()) + using (PixelAccessor pixels = image.Lock()) { decodeAction(pixels); } - using (PixelAccessor pixels = image.Lock()) + using (PixelAccessor pixels = image.Lock()) { for (int y = 0; y < resultHeight; y++) { diff --git a/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColorTests.cs b/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColorTests.cs index 8769d472ba..ce04e0225a 100644 --- a/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColorTests.cs +++ b/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColorTests.cs @@ -12,21 +12,21 @@ namespace ImageSharp.Tests public class WhiteIsZeroTiffColorTests : PhotometricInterpretationTestBase { - private static Color Gray000 = new Color(255, 255, 255, 255); - private static Color Gray128 = new Color(127, 127, 127, 255); - private static Color Gray255 = new Color(0, 0, 0, 255); - private static Color Gray0 = new Color(255, 255, 255, 255); - private static Color Gray8 = new Color(119, 119, 119, 255); - private static Color GrayF = new Color(0, 0, 0, 255); - private static Color Bit0 = new Color(255, 255, 255, 255); - private static Color Bit1 = new Color(0, 0, 0, 255); + private static Rgba32 Gray000 = new Rgba32(255, 255, 255, 255); + private static Rgba32 Gray128 = new Rgba32(127, 127, 127, 255); + private static Rgba32 Gray255 = new Rgba32(0, 0, 0, 255); + private static Rgba32 Gray0 = new Rgba32(255, 255, 255, 255); + private static Rgba32 Gray8 = new Rgba32(119, 119, 119, 255); + private static Rgba32 GrayF = new Rgba32(0, 0, 0, 255); + private static Rgba32 Bit0 = new Rgba32(255, 255, 255, 255); + private static Rgba32 Bit1 = new Rgba32(0, 0, 0, 255); private static byte[] Bilevel_Bytes4x4 = new byte[] { 0b01010000, 0b11110000, 0b01110000, 0b10010000 }; - private static Color[][] Bilevel_Result4x4 = new[] { new[] { Bit0, Bit1, Bit0, Bit1 }, + private static Rgba32[][] Bilevel_Result4x4 = new[] { new[] { Bit0, Bit1, Bit0, Bit1 }, new[] { Bit1, Bit1, Bit1, Bit1 }, new[] { Bit0, Bit1, Bit1, Bit1 }, new[] { Bit1, Bit0, Bit0, Bit1 }}; @@ -36,7 +36,7 @@ namespace ImageSharp.Tests 0b01101001, 0b10100000, 0b10010000, 0b01100000}; - private static Color[][] Bilevel_Result12x4 = new[] { new[] { Bit0, Bit1, Bit0, Bit1, Bit0, Bit1, Bit0, Bit1, Bit0, Bit1, Bit0, Bit1 }, + private static Rgba32[][] Bilevel_Result12x4 = new[] { new[] { Bit0, Bit1, Bit0, Bit1, Bit0, Bit1, Bit0, Bit1, Bit0, Bit1, Bit0, Bit1 }, new[] { Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1 }, new[] { Bit0, Bit1, Bit1, Bit0, Bit1, Bit0, Bit0, Bit1, Bit1, Bit0, Bit1, Bit0 }, new[] { Bit1, Bit0, Bit0, Bit1, Bit0, Bit0, Bit0, Bit0, Bit0, Bit1, Bit1, Bit0 }}; @@ -46,7 +46,7 @@ namespace ImageSharp.Tests 0x08, 0x8F, 0xF0, 0xF8 }; - private static Color[][] Grayscale4_Result4x4 = new[] { new[] { Gray8, GrayF, Gray0, GrayF }, + private static Rgba32[][] Grayscale4_Result4x4 = new[] { new[] { Gray8, GrayF, Gray0, GrayF }, new[] { GrayF, GrayF, GrayF, GrayF }, new[] { Gray0, Gray8, Gray8, GrayF }, new[] { GrayF, Gray0, GrayF, Gray8 }}; @@ -56,7 +56,7 @@ namespace ImageSharp.Tests 0x08, 0x80, 0xF0, 0xF0 }; - private static Color[][] Grayscale4_Result3x4 = new[] { new[] { Gray8, GrayF, Gray0 }, + private static Rgba32[][] Grayscale4_Result3x4 = new[] { new[] { Gray8, GrayF, Gray0 }, new[] { GrayF, GrayF, GrayF }, new[] { Gray0, Gray8, Gray8 }, new[] { GrayF, Gray0, GrayF }}; @@ -66,7 +66,7 @@ namespace ImageSharp.Tests 000, 128, 128, 255, 255, 000, 255, 128 }; - private static Color[][] Grayscale8_Result4x4 = new[] { new[] { Gray128, Gray255, Gray000, Gray255 }, + private static Rgba32[][] Grayscale8_Result4x4 = new[] { new[] { Gray128, Gray255, Gray000, Gray255 }, new[] { Gray255, Gray255, Gray255, Gray255 }, new[] { Gray000, Gray128, Gray128, Gray255 }, new[] { Gray255, Gray000, Gray255, Gray128 }}; @@ -121,7 +121,7 @@ namespace ImageSharp.Tests [Theory] [MemberData(nameof(Bilevel_Data))] - public void Decode_WritesPixelData_Bilevel(byte[] inputData, int bitsPerSample, int left, int top, int width, int height, Color[][] expectedResult) + public void Decode_WritesPixelData_Bilevel(byte[] inputData, int bitsPerSample, int left, int top, int width, int height, Rgba32[][] expectedResult) { AssertDecode(expectedResult, pixels => { @@ -131,7 +131,7 @@ namespace ImageSharp.Tests [Theory] [MemberData(nameof(Grayscale4_Data))] - public void Decode_WritesPixelData_4Bit(byte[] inputData, int bitsPerSample, int left, int top, int width, int height, Color[][] expectedResult) + public void Decode_WritesPixelData_4Bit(byte[] inputData, int bitsPerSample, int left, int top, int width, int height, Rgba32[][] expectedResult) { AssertDecode(expectedResult, pixels => { @@ -141,7 +141,7 @@ namespace ImageSharp.Tests [Theory] [MemberData(nameof(Grayscale8_Data))] - public void Decode_WritesPixelData_8Bit(byte[] inputData, int bitsPerSample, int left, int top, int width, int height, Color[][] expectedResult) + public void Decode_WritesPixelData_8Bit(byte[] inputData, int bitsPerSample, int left, int top, int width, int height, Rgba32[][] expectedResult) { AssertDecode(expectedResult, pixels => { diff --git a/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffDecoderHeaderTests.cs b/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffDecoderHeaderTests.cs index 48d64b71c6..ae581d293b 100644 --- a/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffDecoderHeaderTests.cs +++ b/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffDecoderHeaderTests.cs @@ -111,7 +111,7 @@ namespace ImageSharp.Tests private void TestDecode(TiffDecoder decoder, Stream stream) { Configuration.Default.AddImageFormat(new TiffFormat()); - Image image = decoder.Decode(Configuration.Default, stream, null); + Image image = decoder.Decode(Configuration.Default, stream, null); } } } \ No newline at end of file diff --git a/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffDecoderImageTests.cs b/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffDecoderImageTests.cs index 642cc2c0ed..2cf6384597 100644 --- a/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffDecoderImageTests.cs +++ b/tests/ImageSharp.Formats.Tiff.Tests/Formats/Tiff/TiffDecoderImageTests.cs @@ -31,7 +31,7 @@ namespace ImageSharp.Tests TiffDecoderCore decoder = new TiffDecoderCore(stream, isLittleEndian, null, null); TiffIfd ifd = decoder.ReadIfd(0); - Image image = decoder.DecodeImage(ifd); + Image image = decoder.DecodeImage(ifd); Assert.Equal(ImageWidth, image.Width); Assert.Equal(ImageHeight, image.Height); @@ -82,7 +82,7 @@ namespace ImageSharp.Tests TiffDecoderCore decoder = new TiffDecoderCore(stream, isLittleEndian, null, null); TiffIfd ifd = decoder.ReadIfd(0); - Image image = decoder.DecodeImage(ifd); + Image image = decoder.DecodeImage(ifd); Assert.Equal(expectedHorizonalResolution, image.MetaData.HorizontalResolution, 10); Assert.Equal(expectedVerticalResolution, image.MetaData.VerticalResolution, 10); @@ -99,7 +99,7 @@ namespace ImageSharp.Tests TiffDecoderCore decoder = new TiffDecoderCore(stream, isLittleEndian, null, null); TiffIfd ifd = decoder.ReadIfd(0); - var e = Assert.Throws(() => decoder.DecodeImage(ifd)); + var e = Assert.Throws(() => decoder.DecodeImage(ifd)); Assert.Equal("The TIFF IFD does not specify the image dimensions.", e.Message); } @@ -115,7 +115,7 @@ namespace ImageSharp.Tests TiffDecoderCore decoder = new TiffDecoderCore(stream, isLittleEndian, null, null); TiffIfd ifd = decoder.ReadIfd(0); - var e = Assert.Throws(() => decoder.DecodeImage(ifd)); + var e = Assert.Throws(() => decoder.DecodeImage(ifd)); Assert.Equal("The TIFF IFD does not specify the image dimensions.", e.Message); }