Browse Source

Add test for encode and reload planar tiff

pull/1647/head
Brian Popow 5 years ago
parent
commit
580723fc0a
  1. 2
      src/ImageSharp/Formats/Tiff/TiffBitsPerPixel.cs
  2. 6
      tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderTests.cs
  3. 2
      tests/ImageSharp.Tests/Formats/Tiff/TiffMetadataTests.cs

2
src/ImageSharp/Formats/Tiff/TiffBitsPerPixel.cs

@ -24,7 +24,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff
Bit8 = 8, Bit8 = 8,
/// <summary> /// <summary>
/// 14 bits per pixel. 4 bit for each color channel. /// 12 bits per pixel. 4 bit for each color channel.
/// ///
/// Note: The TiffEncoder does not yet support 4 bits per color channel and will default to 24 bits per pixel. /// Note: The TiffEncoder does not yet support 4 bits per color channel and will default to 24 bits per pixel.
/// </summary> /// </summary>

6
tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderTests.cs

@ -248,6 +248,12 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff
Assert.Equal(expectedCompression, frameMetaData.Compression); Assert.Equal(expectedCompression, frameMetaData.Compression);
} }
// This makes sure, that when decoding a planar tiff, the planar configuration is not carried over to the encoded image.
[Theory]
[WithFile(FlowerRgb444Planar, PixelTypes.Rgba32)]
public void TiffEncoder_EncodePlanar_AndReload_Works<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel> => TestTiffEncoderCore(provider, TiffBitsPerPixel.Bit24, TiffPhotometricInterpretation.Rgb, imageDecoder: new TiffDecoder());
[Theory] [Theory]
[WithFile(Calliphora_RgbUncompressed, PixelTypes.Rgba32)] [WithFile(Calliphora_RgbUncompressed, PixelTypes.Rgba32)]
public void TiffEncoder_EncodeRgb_Works<TPixel>(TestImageProvider<TPixel> provider) public void TiffEncoder_EncodeRgb_Works<TPixel>(TestImageProvider<TPixel> provider)

2
tests/ImageSharp.Tests/Formats/Tiff/TiffMetadataTests.cs

@ -293,7 +293,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff
Assert.Equal(exifProfileInput.GetValue(ExifTag.Copyright).Value, encodedImageExifProfile.GetValue(ExifTag.Copyright).Value); Assert.Equal(exifProfileInput.GetValue(ExifTag.Copyright).Value, encodedImageExifProfile.GetValue(ExifTag.Copyright).Value);
// Note that the encoded profile has PlanarConfiguration explicitly set, which is missing in the original image profile. // Note that the encoded profile has PlanarConfiguration explicitly set, which is missing in the original image profile.
Assert.Equal((ushort)TiffPlanarConfiguration.Chunky, encodedImageExifProfile.GetValue(ExifTag.PlanarConfiguration).Value); Assert.Equal((ushort)TiffPlanarConfiguration.Chunky, encodedImageExifProfile.GetValue(ExifTag.PlanarConfiguration)?.Value);
Assert.Equal(exifProfileInput.Values.Count + 1, encodedImageExifProfile.Values.Count); Assert.Equal(exifProfileInput.Values.Count + 1, encodedImageExifProfile.Values.Count);
} }
} }

Loading…
Cancel
Save