Browse Source

Use different default pixel sampling strategy for PNG

pull/2485/head
James Jackson-South 3 years ago
parent
commit
978776106a
  1. 11
      src/ImageSharp/Formats/Png/PngEncoder.cs
  2. 3
      src/ImageSharp/Memory/Buffer2D{T}.cs

11
src/ImageSharp/Formats/Png/PngEncoder.cs

@ -3,6 +3,7 @@
#nullable disable
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Processing.Processors.Quantization;
namespace SixLabors.ImageSharp.Formats.Png;
@ -11,6 +12,16 @@ namespace SixLabors.ImageSharp.Formats.Png;
/// </summary>
public class PngEncoder : QuantizingImageEncoder
{
/// <summary>
/// Initializes a new instance of the <see cref="PngEncoder"/> class.
/// </summary>
public PngEncoder()
// Hack. TODO: Investigate means to fix/optimize the Wu quantizer.
// The Wu quantizer does not handle the default sampling strategy well for some larger images.
// It's expensive and the results are not better than the extensive strategy.
=> this.PixelSamplingStrategy = new ExtensivePixelSamplingStrategy();
/// <summary>
/// Gets the number of bits per sample or per palette index (not per pixel).
/// Not all values are allowed for all <see cref="ColorType" /> values.

3
src/ImageSharp/Memory/Buffer2D{T}.cs

@ -9,9 +9,6 @@ namespace SixLabors.ImageSharp.Memory;
/// Represents a buffer of value type objects
/// interpreted as a 2D region of <see cref="Width"/> x <see cref="Height"/> elements.
/// </summary>
/// <remarks>
/// Before RC1, this class might be target of API changes, use it on your own risk!
/// </remarks>
/// <typeparam name="T">The value type.</typeparam>
public sealed class Buffer2D<T> : IDisposable
where T : struct

Loading…
Cancel
Save