Browse Source

Merge pull request #356 from SixLabors/js/fix-262

Js/fix 262
af/merge-core
James Jackson-South 9 years ago
committed by GitHub
parent
commit
616cf36616
  1. 8
      src/ImageSharp/Formats/Gif/GifEncoderCore.cs

8
src/ImageSharp/Formats/Gif/GifEncoderCore.cs

@ -98,12 +98,10 @@ namespace SixLabors.ImageSharp.Formats.Gif
this.hasFrames = image.Frames.Count > 1; this.hasFrames = image.Frames.Count > 1;
// Dithering when animating gifs is a bad idea as we introduce pixel tearing across frames. var pixelQuantizer = (IQuantizer<TPixel>)this.quantizer;
var ditheredQuantizer = (IQuantizer<TPixel>)this.quantizer;
ditheredQuantizer.Dither = !this.hasFrames;
// Quantize the image returning a palette. // Quantize the image returning a palette.
QuantizedImage<TPixel> quantized = ditheredQuantizer.Quantize(image.Frames.RootFrame, size); QuantizedImage<TPixel> quantized = pixelQuantizer.Quantize(image.Frames.RootFrame, size);
int index = this.GetTransparentIndex(quantized); int index = this.GetTransparentIndex(quantized);
@ -126,7 +124,7 @@ namespace SixLabors.ImageSharp.Formats.Gif
{ {
if (quantized == null) if (quantized == null)
{ {
quantized = ditheredQuantizer.Quantize(frame, size); quantized = pixelQuantizer.Quantize(frame, size);
} }
this.WriteGraphicalControlExtension(frame.MetaData, writer, this.GetTransparentIndex(quantized)); this.WriteGraphicalControlExtension(frame.MetaData, writer, this.GetTransparentIndex(quantized));

Loading…
Cancel
Save