Browse Source
Merge pull request #2819 from mistoll/bmp_dither
Fix using dither in BmpEncoder when bit per pixel is <= 4
pull/2835/head
James Jackson-South
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
9 additions and
3 deletions
-
src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs
|
|
|
@ -575,7 +575,9 @@ internal sealed class BmpEncoderCore |
|
|
|
{ |
|
|
|
using IQuantizer<TPixel> frameQuantizer = this.quantizer.CreatePixelSpecificQuantizer<TPixel>(configuration, new QuantizerOptions() |
|
|
|
{ |
|
|
|
MaxColors = 16 |
|
|
|
MaxColors = 16, |
|
|
|
Dither = this.quantizer.Options.Dither, |
|
|
|
DitherScale = this.quantizer.Options.DitherScale |
|
|
|
}); |
|
|
|
|
|
|
|
frameQuantizer.BuildPalette(this.pixelSamplingStrategy, image); |
|
|
|
@ -623,7 +625,9 @@ internal sealed class BmpEncoderCore |
|
|
|
{ |
|
|
|
using IQuantizer<TPixel> frameQuantizer = this.quantizer.CreatePixelSpecificQuantizer<TPixel>(configuration, new QuantizerOptions() |
|
|
|
{ |
|
|
|
MaxColors = 4 |
|
|
|
MaxColors = 4, |
|
|
|
Dither = this.quantizer.Options.Dither, |
|
|
|
DitherScale = this.quantizer.Options.DitherScale |
|
|
|
}); |
|
|
|
|
|
|
|
frameQuantizer.BuildPalette(this.pixelSamplingStrategy, image); |
|
|
|
@ -680,7 +684,9 @@ internal sealed class BmpEncoderCore |
|
|
|
{ |
|
|
|
using IQuantizer<TPixel> frameQuantizer = this.quantizer.CreatePixelSpecificQuantizer<TPixel>(configuration, new QuantizerOptions() |
|
|
|
{ |
|
|
|
MaxColors = 2 |
|
|
|
MaxColors = 2, |
|
|
|
Dither = this.quantizer.Options.Dither, |
|
|
|
DitherScale = this.quantizer.Options.DitherScale |
|
|
|
}); |
|
|
|
|
|
|
|
frameQuantizer.BuildPalette(this.pixelSamplingStrategy, image); |
|
|
|
|