You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BmpEncoder does not respect QuantizerOptions.Dither when BitsPerPixel is 1, 2 or 4 #2817
the QuantizerOptions is replaced with new QuanitzerOptions, which does not include the inital Dither values. Similar code is in Write2BitPixelData and Write4BitPixelData.
I'd write a pull request, but I don't know how you want to handle that. Like modify the original options, create a full clone opt the original options, remove the new options completely, or whatever you come up with.
Steps to Reproduce
var image = // Load any image
var palette =new Color[] { Color.Black, Color.White };
var quantizerOptions = new QuantizerOptions() { MaxColors = 2, Dither = **null** };
var quantizer = new PaletteQuantizer(palette, quantizerOptions);
var encoder = new BmpEncoder { BitsPerPixel = BmpBitsPerPixel.Pixel1, Quantizer = quantizer };
image.SaveAsync(anyFile, encoder);
The result is a image with dithering (example created from car.bmp from test images)
Thanks for the detail here and analysis. It's very much appreciated!
The correct approach would be to do the following all places where we require new options.
usingIQuantizer<TPixel>frameQuantizer=this.quantizer.CreatePixelSpecificQuantizer<TPixel>(configuration,newQuantizerOptions(){MaxColors=2,// Use correct value for each methodDither=this.quantizer.Options.Dither,DitherScale=this.quantizer.Options.DitherScale});If you could submit a PR that would be really great.
Activity
JimBobSquarePants commentedon Oct 1, 2024
Thanks for the detail here and analysis. It's very much appreciated!
The correct approach would be to do the following all places where we require new options.