Skip to content

Commit 33192d3

Browse files
committed
Switch default quantizer for the bitmap encoder to Wu-quantizer
1 parent ea8bef4 commit 33192d3

File tree

4 files changed

+5
-14
lines changed

4 files changed

+5
-14
lines changed

src/ImageSharp/Formats/Bmp/BmpEncoder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public sealed class BmpEncoder : IImageEncoder, IBmpEncoderOptions
3030

3131
/// <summary>
3232
/// Gets or sets the quantizer for reducing the color count for 8-Bit images.
33-
/// Defaults to OctreeQuantizer.
33+
/// Defaults to Wu Quantizer.
3434
/// </summary>
3535
public IQuantizer Quantizer { get; set; }
3636

src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public BmpEncoderCore(IBmpEncoderOptions options, MemoryAllocator memoryAllocato
9898
this.memoryAllocator = memoryAllocator;
9999
this.bitsPerPixel = options.BitsPerPixel;
100100
this.writeV4Header = options.SupportTransparency;
101-
this.quantizer = options.Quantizer ?? KnownQuantizers.Octree;
101+
this.quantizer = options.Quantizer ?? KnownQuantizers.Wu;
102102
}
103103

104104
/// <summary>

src/ImageSharp/Formats/Bmp/IBmpEncoderOptions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ internal interface IBmpEncoderOptions
2525

2626
/// <summary>
2727
/// Gets the quantizer for reducing the color count for 8-Bit, 4-Bit, and 1-Bit images.
28-
/// Defaults to the Octree Quantizer.
2928
/// </summary>
3029
IQuantizer Quantizer { get; }
3130
}

tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,7 @@ public void Encode_1Bit_WithV3Header_Works<TPixel>(
212212
// The Magick Reference Decoder can not decode 1-Bit bitmaps, so only execute this on windows.
213213
if (TestEnvironment.IsWindows)
214214
{
215-
TestBmpEncoderCore(
216-
provider,
217-
bitsPerPixel,
218-
supportTransparency: false,
219-
quantizer: KnownQuantizers.Wu); // using the wu quantizer, because the octree seems to have problems with just two colors.
215+
TestBmpEncoderCore(provider, bitsPerPixel, supportTransparency: false);
220216
}
221217
}
222218

@@ -230,11 +226,7 @@ public void Encode_1Bit_WithV4Header_Works<TPixel>(
230226
// The Magick Reference Decoder can not decode 1-Bit bitmaps, so only execute this on windows.
231227
if (TestEnvironment.IsWindows)
232228
{
233-
TestBmpEncoderCore(
234-
provider,
235-
bitsPerPixel,
236-
supportTransparency: true,
237-
quantizer: KnownQuantizers.Wu); // using the wu quantizer, because the octree seems to have problems with just two colors.
229+
TestBmpEncoderCore(provider, bitsPerPixel, supportTransparency: true);
238230
}
239231
}
240232

@@ -351,7 +343,7 @@ private static void TestBmpEncoderCore<TPixel>(
351343
{
352344
BitsPerPixel = bitsPerPixel,
353345
SupportTransparency = supportTransparency,
354-
Quantizer = quantizer ?? KnownQuantizers.Octree
346+
Quantizer = quantizer ?? KnownQuantizers.Wu
355347
};
356348

357349
// Does DebugSave & load reference CompareToReferenceInput():

0 commit comments

Comments
 (0)