Skip to content

Commit 9787761

Browse files
Use different default pixel sampling strategy for PNG
1 parent c3ed86d commit 9787761

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

src/ImageSharp/Formats/Png/PngEncoder.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#nullable disable
44

55
using SixLabors.ImageSharp.Advanced;
6+
using SixLabors.ImageSharp.Processing.Processors.Quantization;
67

78
namespace SixLabors.ImageSharp.Formats.Png;
89

@@ -11,6 +12,16 @@ namespace SixLabors.ImageSharp.Formats.Png;
1112
/// </summary>
1213
public class PngEncoder : QuantizingImageEncoder
1314
{
15+
/// <summary>
16+
/// Initializes a new instance of the <see cref="PngEncoder"/> class.
17+
/// </summary>
18+
public PngEncoder()
19+
20+
// Hack. TODO: Investigate means to fix/optimize the Wu quantizer.
21+
// The Wu quantizer does not handle the default sampling strategy well for some larger images.
22+
// It's expensive and the results are not better than the extensive strategy.
23+
=> this.PixelSamplingStrategy = new ExtensivePixelSamplingStrategy();
24+
1425
/// <summary>
1526
/// Gets the number of bits per sample or per palette index (not per pixel).
1627
/// Not all values are allowed for all <see cref="ColorType" /> values.

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ namespace SixLabors.ImageSharp.Memory;
99
/// Represents a buffer of value type objects
1010
/// interpreted as a 2D region of <see cref="Width"/> x <see cref="Height"/> elements.
1111
/// </summary>
12-
/// <remarks>
13-
/// Before RC1, this class might be target of API changes, use it on your own risk!
14-
/// </remarks>
1512
/// <typeparam name="T">The value type.</typeparam>
1613
public sealed class Buffer2D<T> : IDisposable
1714
where T : struct

0 commit comments

Comments
 (0)