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; this.nextValidCode = EoiCode + 1;
} }
private static int MaxValue(int codeLen) private static int MaxValue(int codeLen) => (1 << codeLen) - 1;
{
return (1 << codeLen) - 1;
}
private static int BitmaskFor(int bits) private static int BitmaskFor(int bits) => MaxValue(bits);
{
return MaxValue(bits);
}
} }
} }

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

@ -24,6 +24,7 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff
/// <summary> /// <summary>
/// Gets the encoding mode to use. RGB, RGB with color palette or gray. /// 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> /// </summary>
TiffEncodingMode Mode { get; } TiffEncodingMode Mode { get; }

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

@ -82,6 +82,7 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff
/// <summary> /// <summary>
/// Gets the encoding mode to use. RGB, RGB with color palette or gray. /// 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> /// </summary>
internal TiffEncodingMode Mode { get; private set; } internal TiffEncodingMode Mode { get; private set; }
@ -118,6 +119,10 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff
{ {
this.Mode = TiffEncodingMode.BiColor; this.Mode = TiffEncodingMode.BiColor;
} }
else
{
this.Mode = TiffEncodingMode.Rgb;
}
} }
this.SetPhotometricInterpretation(); this.SetPhotometricInterpretation();

Loading…
Cancel
Save