Browse Source

If no encoding mode is specified in the options, RGB will be used.

pull/1570/head
Brian Popow 5 years ago
parent
commit
2fa3da40e1
  1. 10
      src/ImageSharp/Formats/Tiff/Compression/Compressors/TiffLzwEncoder.cs
  2. 1
      src/ImageSharp/Formats/Tiff/ITiffEncoderOptions.cs
  3. 5
      src/ImageSharp/Formats/Tiff/TiffEncoderCore.cs

10
src/ImageSharp/Formats/Tiff/Compression/Compressors/TiffLzwEncoder.cs

@ -260,14 +260,8 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff.Utils
this.nextValidCode = EoiCode + 1;
}
private static int MaxValue(int codeLen)
{
return (1 << codeLen) - 1;
}
private static int MaxValue(int codeLen) => (1 << codeLen) - 1;
private static int BitmaskFor(int bits)
{
return MaxValue(bits);
}
private static int BitmaskFor(int bits) => MaxValue(bits);
}
}

1
src/ImageSharp/Formats/Tiff/ITiffEncoderOptions.cs

@ -24,6 +24,7 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff
/// <summary>
/// Gets the encoding mode to use. RGB, RGB with color palette or gray.
/// If no mode is specified in the options, RGB will be used.
/// </summary>
TiffEncodingMode Mode { get; }

5
src/ImageSharp/Formats/Tiff/TiffEncoderCore.cs

@ -82,6 +82,7 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff
/// <summary>
/// Gets the encoding mode to use. RGB, RGB with color palette or gray.
/// If no mode is specified in the options, RGB will be used.
/// </summary>
internal TiffEncodingMode Mode { get; private set; }
@ -118,6 +119,10 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff
{
this.Mode = TiffEncodingMode.BiColor;
}
else
{
this.Mode = TiffEncodingMode.Rgb;
}
}
this.SetPhotometricInterpretation();

Loading…
Cancel
Save